Jump to content

Help With Registering Configured WorldCarver 1.18.2


UHQ_GAMES

Recommended Posts

Hey All! I'm trying to register my configured mod carver in 1.18.2 and I'm have a hard time finding a method to register it. Any help would be greatly appreciated! Relevant code below

 

package net.regionsunexplored.world.gen.carver;

import net.minecraft.core.Holder;
import net.minecraft.data.BuiltinRegistries;
import net.minecraft.util.valueproviders.ConstantFloat;
import net.minecraft.util.valueproviders.TrapezoidFloat;
import net.minecraft.util.valueproviders.UniformFloat;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.levelgen.VerticalAnchor;
import net.minecraft.world.level.levelgen.carver.CanyonCarverConfiguration;
import net.minecraft.world.level.levelgen.carver.CarverConfiguration;
import net.minecraft.world.level.levelgen.carver.CarverDebugSettings;
import net.minecraft.world.level.levelgen.carver.CaveCarverConfiguration;
import net.minecraft.world.level.levelgen.carver.ConfiguredWorldCarver;
import net.minecraft.world.level.levelgen.carver.WorldCarver;
import net.minecraft.world.level.levelgen.heightproviders.UniformHeight;
import net.minecraft.core.Registry;
import net.minecraft.data.worldgen.Carvers;
import net.minecraft.resources.ResourceLocation;

public class ModCarvers{
	
   public static final Holder<ConfiguredWorldCarver<CaveCarverConfiguration>> MOD_CAVE = register("mod_cave", ModWorldCarver.RU_CAVE.configured(new CaveCarverConfiguration(0.15F, UniformHeight.of(VerticalAnchor.aboveBottom(8), VerticalAnchor.absolute(180)), UniformFloat.of(0.1F, 0.9F), VerticalAnchor.aboveBottom(8), CarverDebugSettings.of(false, Blocks.CRIMSON_BUTTON.defaultBlockState()), UniformFloat.of(0.7F, 1.4F), UniformFloat.of(0.8F, 1.3F), UniformFloat.of(-1.0F, -0.4F))));

    private static <WC extends CarverConfiguration> Holder<ConfiguredWorldCarver<WC>> register(String name, ConfiguredWorldCarver<WC> ruCarver) {
      return BuiltinRegistries.registerExact(BuiltinRegistries.CONFIGURED_CARVER, name, ruCarver);
   }

   
}

 

Link to comment
Share on other sites

You use DeferredRegister, https://forge.gemwire.uk/wiki/Registration/1.18

 

something like (untested code):

public class ModCarvers {

    private static final DeferredRegister<WorldCarver<?>> CARVERS = DeferredRegister.create(Registry.CARVER_REGISTRY, MODID);
    private static final DeferredRegister<ConfiguredWorldCarver<?>> CONFGIURED_CARVERS = DeferredRegister.create(Registry.CONFIGURED_CARVER_REGISTRY, MODID);

    public static final RegistryObject<WorldCarver<CaveCarverConfiguration>> MY_CARVER = CARVERS.register("mod_cave", 
            () -> new MyCaveWorldCarver(CaveCarverConfiguration.CODEC));

    public static final RegistryObject<ConfiguredWorldCarver<CaveCarverConfiguration>> MY_CONFIGURED_CARVER = CONFGIURED_CARVERS.register("mod_cave", 
            () -> MY_CARVER.get().configured(new CaveCarverConfiguration(0.15F, UniformHeight.of(VerticalAnchor.aboveBottom(8), VerticalAnchor.absolute(180)), UniformFloat.of(0.1F, 0.9F), VerticalAnchor.aboveBottom(8), CarverDebugSettings.of(false, Blocks.CRIMSON_BUTTON.defaultBlockState()), UniformFloat.of(0.7F, 1.4F), UniformFloat.of(0.8F, 1.3F), UniformFloat.of(-1.0F, -0.4F))));

    public static void register(IEventBus bus) {
        CARVERS.register(bus);
        CONFGIURED_CARVERS.register(bus);
    }
}

Then as usual, call ModCarvers.register() from your Mod's constructor.

Edited by warjort

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Link to comment
Share on other sites

RegistryObject.getHolder()

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Link to comment
Share on other sites

Now  i have another problem lol, i changed the carve method in my mod carver cause i was having issues with aquifers and now im having an issue with the floorLevel variable not being accessible, is there another method to do this?

 

public boolean carve(CarvingContext p_190704_, CaveCarverConfiguration p_190705_, ChunkAccess p_190706_, Function<BlockPos, Holder<Biome>> p_190707_, Random p_190708_, Aquifer p_190709_, ChunkPos p_190710_, CarvingMask p_190711_) {
      int i = SectionPos.sectionToBlockCoord(this.getRange() * 2 - 1);
      int j = p_190708_.nextInt(p_190708_.nextInt(p_190708_.nextInt(this.getCaveBound()) + 1) + 1);
	  
      for(int k = 0; k < j; ++k) {
         double d0 = (double)p_190710_.getBlockX(p_190708_.nextInt(16));
         double d1 = (double)p_190705_.y.sample(p_190708_, p_190704_);
         double d2 = (double)p_190710_.getBlockZ(p_190708_.nextInt(16));
         double d3 = (double)p_190705_.horizontalRadiusMultiplier.sample(p_190708_);
         double d4 = (double)p_190705_.verticalRadiusMultiplier.sample(p_190708_);
         double d5 = (double)floorLevel.sample(p_190708_);
         WorldCarver.CarveSkipChecker worldcarver$carveskipchecker = (p_159202_, p_159203_, p_159204_, p_159205_, p_159206_) -> {
            return shouldSkip(p_159203_, p_159204_, p_159205_, d5);
         };
         int l = 1;
         if (p_190708_.nextInt(4) == 0) {
            double d6 = (double)p_190705_.yScale.sample(p_190708_);
            float f1 = 1.0F + p_190708_.nextFloat() * 6.0F;
            this.createRoom(p_190704_, p_190705_, p_190706_, p_190707_, p_190709_, d0, d1, d2, f1, d6, p_190711_, worldcarver$carveskipchecker);
            l += p_190708_.nextInt(4);
         }

         for(int k1 = 0; k1 < l; ++k1) {
            float f = p_190708_.nextFloat() * ((float)Math.PI * 2F);
            float f3 = (p_190708_.nextFloat() - 0.5F) / 4.0F;
            float f2 = this.getThickness(p_190708_);
            int i1 = i - p_190708_.nextInt(i / 4);
            int j1 = 0;
            this.createTunnel(p_190704_, p_190705_, p_190706_, p_190707_, p_190708_.nextLong(), p_190709_, d0, d1, d2, d3, d4, f2, f, f3, 0, i1, this.getYScale(), p_190711_, worldcarver$carveskipchecker);
         }
      }

      return true;
   }

this is basically the normal CaveWorldCarver class but i cant access floorLevel from outside the original package, any help is appreciated!

Link to comment
Share on other sites

https://forge.gemwire.uk/wiki/Access_Transformers/1.18

There is supposed to be a bot on the forge discord that help you find the field name.

 

But you could also just make your own CaveCarverConfiguration class.

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Link to comment
Share on other sites

Don't paraphrase errors, show them with the full stacktrace.

Also show the code you tried. We have no psychic powers.

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Link to comment
Share on other sites

ah yes sorry, im still learning a lot of this so im not the best at it yet, for my CaveCarverConfig i just copied the builtin one, probably doing this all wrong

 

public class ModCarverConfiguration extends CarverConfiguration {
   public static final Codec<ModCarverConfiguration> CODEC = RecordCodecBuilder.create((p_159184_) -> {
      return p_159184_.group(CarverConfiguration.CODEC.forGetter((p_159192_) -> {
         return p_159192_;
      }), FloatProvider.CODEC.fieldOf("horizontal_radius_multiplier").forGetter((p_159190_) -> {
         return p_159190_.horizontalRadiusMultiplier;
      }), FloatProvider.CODEC.fieldOf("vertical_radius_multiplier").forGetter((p_159188_) -> {
         return p_159188_.verticalRadiusMultiplier;
      }), FloatProvider.codec(-1.0F, 1.0F).fieldOf("floor_level").forGetter((p_159186_) -> {
         return p_159186_.floorLevel;
      })).apply(p_159184_, ModCarverConfiguration::new);
   });
   public final FloatProvider horizontalRadiusMultiplier;
   public final FloatProvider verticalRadiusMultiplier;
   final FloatProvider floorLevel;

   public ModCarverConfiguration(float p_190653_, HeightProvider p_190654_, FloatProvider p_190655_, VerticalAnchor p_190656_, CarverDebugSettings p_190657_, FloatProvider p_190658_, FloatProvider p_190659_, FloatProvider p_190660_) {
      super(p_190653_, p_190654_, p_190655_, p_190656_, p_190657_);
      this.horizontalRadiusMultiplier = p_190658_;
      this.verticalRadiusMultiplier = p_190659_;
      this.floorLevel = p_190660_;
   }

   public ModCarverConfiguration(float p_159160_, HeightProvider p_159161_, FloatProvider p_159162_, VerticalAnchor p_159163_, boolean p_159164_, FloatProvider p_159165_, FloatProvider p_159166_, FloatProvider p_159167_) {
      this(p_159160_, p_159161_, p_159162_, p_159163_, CarverDebugSettings.DEFAULT, p_159165_, p_159166_, p_159167_);
   }

   public ModCarverConfiguration(CarverConfiguration p_159179_, FloatProvider p_159180_, FloatProvider p_159181_, FloatProvider p_159182_) {
      this(p_159179_.probability, p_159179_.y, p_159179_.yScale, p_159179_.lavaLevel, p_159179_.debugSettings, p_159180_, p_159181_, p_159182_);
   }
}

again thanks for the help, i would still be stuck on the first problem without it

Link to comment
Share on other sites

That is just a copied and renamed version of the vanilla class. It would be pretty hard to get that wrong. 🙂 

But you don't show where you use it or the error you are getting.

  • Like 1

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Link to comment
Share on other sites

ohh my bad sorry i misunderstood

public class ModCaveCarver extends CaveWorldCarver {
   public ModCaveCarver(Codec<ModCarverConfiguration> p_159194_) {
      super(p_159194_);
      this.replaceableBlocks = ImmutableSet.of(RegionsUnexploredModBlocks.MUD.get(), Blocks.STONE, Blocks.GRANITE, Blocks.DIORITE, Blocks.ANDESITE, Blocks.DIRT, Blocks.COARSE_DIRT, Blocks.PODZOL, Blocks.GRASS_BLOCK, Blocks.TERRACOTTA, Blocks.WHITE_TERRACOTTA, Blocks.ORANGE_TERRACOTTA, Blocks.MAGENTA_TERRACOTTA, Blocks.LIGHT_BLUE_TERRACOTTA, Blocks.YELLOW_TERRACOTTA, Blocks.LIME_TERRACOTTA, Blocks.PINK_TERRACOTTA, Blocks.GRAY_TERRACOTTA, Blocks.LIGHT_GRAY_TERRACOTTA, Blocks.CYAN_TERRACOTTA, Blocks.PURPLE_TERRACOTTA, Blocks.BLUE_TERRACOTTA, Blocks.BROWN_TERRACOTTA, Blocks.GREEN_TERRACOTTA, Blocks.RED_TERRACOTTA, Blocks.BLACK_TERRACOTTA, Blocks.SANDSTONE, Blocks.RED_SANDSTONE, Blocks.MYCELIUM, Blocks.SNOW, Blocks.PACKED_ICE, Blocks.DEEPSLATE, Blocks.CALCITE, Blocks.SAND, Blocks.RED_SAND, Blocks.GRAVEL, Blocks.TUFF, Blocks.GRANITE, Blocks.IRON_ORE, Blocks.DEEPSLATE_IRON_ORE, Blocks.RAW_IRON_BLOCK, Blocks.COPPER_ORE, Blocks.DEEPSLATE_COPPER_ORE, Blocks.RAW_COPPER_BLOCK);
      this.liquids = ImmutableSet.of(Fluids.LAVA, Fluids.WATER);
   }

   public boolean isStartChunk(ModCarverConfiguration p_159263_, Random p_159264_) {
      return p_159264_.nextFloat() <= p_159263_.probability;
   }
    
    public boolean carve(CarvingContext p_190704_, ModCarverConfiguration p_190705_, ChunkAccess p_190706_, Function<BlockPos, Holder<Biome>> p_190707_, Random p_190708_, Aquifer p_190709_, ChunkPos p_190710_, CarvingMask p_190711_) {
      int i = SectionPos.sectionToBlockCoord(this.getRange() * 2 - 1);
      int j = p_190708_.nextInt(p_190708_.nextInt(p_190708_.nextInt(this.getCaveBound()) + 1) + 1);
	  
      for(int k = 0; k < j; ++k) {
         double d0 = (double)p_190710_.getBlockX(p_190708_.nextInt(16));
         double d1 = (double)p_190705_.y.sample(p_190708_, p_190704_);
         double d2 = (double)p_190710_.getBlockZ(p_190708_.nextInt(16));
         double d3 = (double)p_190705_.horizontalRadiusMultiplier.sample(p_190708_);
         double d4 = (double)p_190705_.verticalRadiusMultiplier.sample(p_190708_);
         double d5 = (double)p_190705_.floorLevel.sample(p_190708_);
         WorldCarver.CarveSkipChecker worldcarver$carveskipchecker = (p_159202_, p_159203_, p_159204_, p_159205_, p_159206_) -> {
            return shouldSkip(p_159203_, p_159204_, p_159205_, d5);
         };
         int l = 1;
         if (p_190708_.nextInt(4) == 0) {
            double d6 = (double)p_190705_.yScale.sample(p_190708_);
            float f1 = 1.0F + p_190708_.nextFloat() * 6.0F;
            this.createRoom(p_190704_, p_190705_, p_190706_, p_190707_, p_190709_, d0, d1, d2, f1, d6, p_190711_, worldcarver$carveskipchecker);
            l += p_190708_.nextInt(4);
         }

         for(int k1 = 0; k1 < l; ++k1) {
            float f = p_190708_.nextFloat() * ((float)Math.PI * 2F);
            float f3 = (p_190708_.nextFloat() - 0.5F) / 4.0F;
            float f2 = this.getThickness(p_190708_);
            int i1 = i - p_190708_.nextInt(i / 4);
            int j1 = 0;
            this.createTunnel(p_190704_, p_190705_, p_190706_, p_190707_, p_190708_.nextLong(), p_190709_, d0, d1, d2, d3, d4, f2, f, f3, 0, i1, this.getYScale(), p_190711_, worldcarver$carveskipchecker);
         }
      }

      return true;
   }
   
   protected int getCaveBound() {
      return 15;
   }

   protected float getThickness(Random p_64834_) {
      float f = p_64834_.nextFloat() * 2.0F + p_64834_.nextFloat();
      if (p_64834_.nextInt(10) == 0) {
         f *= p_64834_.nextFloat() * p_64834_.nextFloat() * 3.0F + 1.0F;
      }

      return f;
   }

   protected double getYScale() {
      return 1.0D;
   }

   protected void createRoom(CarvingContext p_190691_, ModCarverConfiguration p_190692_, ChunkAccess p_190693_, Function<BlockPos, Holder<Biome>> p_190694_, Aquifer p_190695_, double p_190696_, double p_190697_, double p_190698_, float p_190699_, double p_190700_, CarvingMask p_190701_, WorldCarver.CarveSkipChecker p_190702_) {
      double d0 = 1.5D + (double)(Mth.sin(((float)Math.PI / 2F)) * p_190699_);
      double d1 = d0 * p_190700_;
      this.carveEllipsoid(p_190691_, p_190692_, p_190693_, p_190694_, p_190695_, p_190696_ + 1.0D, p_190697_, p_190698_, d0, d1, p_190701_, p_190702_);
   }

   protected void createTunnel(CarvingContext p_190671_, ModCarverConfiguration p_190672_, ChunkAccess p_190673_, Function<BlockPos, Holder<Biome>> p_190674_, long p_190675_, Aquifer p_190676_, double p_190677_, double p_190678_, double p_190679_, double p_190680_, double p_190681_, float p_190682_, float p_190683_, float p_190684_, int p_190685_, int p_190686_, double p_190687_, CarvingMask p_190688_, WorldCarver.CarveSkipChecker p_190689_) {
      Random random = new Random(p_190675_);
      int i = random.nextInt(p_190686_ / 2) + p_190686_ / 4;
      boolean flag = random.nextInt(6) == 0;
      float f = 0.0F;
      float f1 = 0.0F;

      for(int j = p_190685_; j < p_190686_; ++j) {
         double d0 = 1.5D + (double)(Mth.sin((float)Math.PI * (float)j / (float)p_190686_) * p_190682_);
         double d1 = d0 * p_190687_;
         float f2 = Mth.cos(p_190684_);
         p_190677_ += (double)(Mth.cos(p_190683_) * f2);
         p_190678_ += (double)Mth.sin(p_190684_);
         p_190679_ += (double)(Mth.sin(p_190683_) * f2);
         p_190684_ *= flag ? 0.92F : 0.7F;
         p_190684_ += f1 * 0.1F;
         p_190683_ += f * 0.1F;
         f1 *= 0.9F;
         f *= 0.75F;
         f1 += (random.nextFloat() - random.nextFloat()) * random.nextFloat() * 2.0F;
         f += (random.nextFloat() - random.nextFloat()) * random.nextFloat() * 4.0F;
         if (j == i && p_190682_ > 1.0F) {
            this.createTunnel(p_190671_, p_190672_, p_190673_, p_190674_, random.nextLong(), p_190676_, p_190677_, p_190678_, p_190679_, p_190680_, p_190681_, random.nextFloat() * 0.5F + 0.5F, p_190683_ - ((float)Math.PI / 2F), p_190684_ / 3.0F, j, p_190686_, 1.0D, p_190688_, p_190689_);
            this.createTunnel(p_190671_, p_190672_, p_190673_, p_190674_, random.nextLong(), p_190676_, p_190677_, p_190678_, p_190679_, p_190680_, p_190681_, random.nextFloat() * 0.5F + 0.5F, p_190683_ + ((float)Math.PI / 2F), p_190684_ / 3.0F, j, p_190686_, 1.0D, p_190688_, p_190689_);
            return;
         }

         if (random.nextInt(4) != 0) {
            if (!canReach(p_190673_.getPos(), p_190677_, p_190679_, j, p_190686_, p_190682_)) {
               return;
            }

            this.carveEllipsoid(p_190671_, p_190672_, p_190673_, p_190674_, p_190676_, p_190677_, p_190678_, p_190679_, d0 * p_190680_, d1 * p_190681_, p_190688_, p_190689_);
         }
      }

   }

   private static boolean shouldSkip(double p_159196_, double p_159197_, double p_159198_, double p_159199_) {
      if (p_159197_ <= p_159199_) {
         return true;
      } else {
         return p_159196_ * p_159196_ + p_159197_ * p_159197_ + p_159198_ * p_159198_ >= 1.0D;
      }
   }
}

and these are the errors my console is spitting out

> Task :downloadMcpConfig
> Task :extractSrg UP-TO-DATE
> Task :createMcpToSrg UP-TO-DATE
> Task :compileJava
C:\Users\Eric Adams\Documents\R_U_1.18.2\src\main\java\net\regionsunexplored\world\gen\ModCaveCarver.java:48: error: incompatible types: Codec cannot be converted to Codec  
super(p_159194_);
      ^
C:\Users\Eric Adams\Documents\R_U_1.18.2\src\main\java\net\regionsunexplored\world\gen\ModCaveCarver.java:112: error: incompatible types: ModCarverConfiguration cannot be converted to CaveCarverConfiguration  
this.carveEllipsoid(p_190691_, p_190692_, p_190693_, p_190694_, p_190695_, p_190696_ + 1.0D, p_190697_, p_190698_, d0, d1, p_190701_, p_190702_);
                               ^
C:\Users\Eric Adams\Documents\R_U_1.18.2\src\main\java\net\regionsunexplored\world\gen\ModCaveCarver.java:147: error: incompatible types: ModCarverConfiguration cannot be converted to CaveCarverConfiguration   
this.carveEllipsoid(p_190671_, p_190672_, p_190673_, p_190674_, p_190676_, p_190677_, p_190678_, p_190679_, d0 * p_190680_, d1 * p_190681_, p_190688_, p_190689_);
                               ^
C:\Users\Eric Adams\Documents\R_U_1.18.2\src\main\java\net\regionsunexplored\world\gen\ModWorldCarver.java:62: error: incompatible types: Codec cannot be converted to Codec   
() -> new ModCaveCarver(CaveCarverConfiguration.CODEC));
                                               ^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
4 errors
> Task :compileJava FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 2s
4 actionable tasks: 2 executed, 2 up-to-date
 
BUILD FAILED
Task completed in 4 seconds

 

Edited by UHQ_GAMES
Link to comment
Share on other sites

 This is a compiler error.

If the compiler tells you something is wrong, you need to be able to understand how to fix it.

 

It's caused by

public class ModCaveCarver extends CaveWorldCarver {

CaveWorldCarver needs the vanilla configuration codec in its constructor.

 

But you don't need to extend that class, you should have

public class ModCaveCarver extends WorldCarver<ModCarverConfiguration> {

 

  • Like 1

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Link to comment
Share on other sites

You should donate to LexManos who pays for these forums.

See his footer: https://forums.minecraftforge.net/topic/115670-forge-431-minecraft-1192/#comment-511620

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Link to comment
Share on other sites

Awesome thank you! I'll definately be donating! and one last thing now, sorry for being annoying,

 

now that I have my biome feature set up and added to my biome i have a weird problem, i load up a Single Biome world and the carvers work perfect. However using the Default world type its almost like its using the default cave carvers. seems like everything is correct but im not too sure

This is the code for the cave biome feature for my biomes

public class ModBiomeDefaultFeatures {
   public static void addCaves(BiomeGenerationSettings.Builder p_194721_) {
      p_194721_.addCarver(GenerationStep.Carving.AIR, ModCarvers.CAVE.getHolder().get());
      p_194721_.addCarver(GenerationStep.Carving.AIR, ModCarvers.CAVE_EXTRA_UNDERGROUND.getHolder().get());
      p_194721_.addCarver(GenerationStep.Carving.AIR, ModCarvers.CANYON.getHolder().get());
      p_194721_.addFeature(GenerationStep.Decoration.LAKES, MiscOverworldPlacements.LAKE_LAVA_UNDERGROUND);
      p_194721_.addFeature(GenerationStep.Decoration.LAKES, MiscOverworldPlacements.LAKE_LAVA_SURFACE);
   }
}

which is then added using this in the OverworldBiome class

private static void globalOverworldGeneration(BiomeGenerationSettings.Builder builder)
    {
        ModBiomeDefaultFeatures.addCaves(builder);
        BiomeDefaultFeatures.addDefaultCrystalFormations(builder);
        BiomeDefaultFeatures.addDefaultMonsterRoom(builder);
        BiomeDefaultFeatures.addDefaultUndergroundVariety(builder);
        BiomeDefaultFeatures.addDefaultSprings(builder);
        BiomeDefaultFeatures.addSurfaceFreezing(builder);
    }

I also noticed removing the addCaves method from Overworld biomes stops caves from spawning in single biome, but not in default.

Edited by UHQ_GAMES
Link to comment
Share on other sites

You don't post the full context again, but I would guess this is configuring your custom Biome?

 

Your biome is not present in the normal worldgen.

If you want to modify other people's biomes (including vanilla) you need to use the BiomeLoadingEvent, it is called for every registered biome.

In particular, event.getGeneration() gives you access each biome's BiomeGenerationSettingsBuilder

Edited by warjort
  • Like 1

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Link to comment
Share on other sites

ah again sorry, ill post my full biome setup, i guess another big this is im using terrablender to manage biome placement

public class OverworldBiomes
{
    @Nullable
    private static final Music NORMAL_MUSIC = null;

    protected static int calculateSkyColor(float color)
    {
        float $$1 = color / 3.0F;
        $$1 = Mth.clamp($$1, -1.0F, 1.0F);
        return Mth.hsvToRgb(0.62222224F - $$1 * 0.05F, 0.5F + $$1 * 0.1F, 1.0F);
    }

    private static Biome biome(Biome.Precipitation precipitation, Biome.BiomeCategory category, float temperature, float downfall, MobSpawnSettings.Builder spawnBuilder, BiomeGenerationSettings.Builder biomeBuilder, @Nullable Music music)
    {
        return biome(precipitation, category, temperature, downfall, 4159204, 329011, spawnBuilder, biomeBuilder, music);
    }

    private static Biome biome(Biome.Precipitation precipitation, Biome.BiomeCategory category, float temperature, float downfall, int waterColor, int waterFogColor, MobSpawnSettings.Builder spawnBuilder, BiomeGenerationSettings.Builder biomeBuilder, @Nullable Music music)
    {
        return (new Biome.BiomeBuilder()).precipitation(precipitation).biomeCategory(category).temperature(temperature).downfall(downfall).specialEffects((new BiomeSpecialEffects.Builder()).waterColor(waterColor).waterFogColor(waterFogColor).fogColor(12638463).skyColor(calculateSkyColor(temperature)).ambientMoodSound(AmbientMoodSettings.LEGACY_CAVE_SETTINGS).backgroundMusic(music).build()).mobSpawnSettings(spawnBuilder.build()).generationSettings(biomeBuilder.build()).build();
    }

    private static void globalOverworldGeneration(BiomeGenerationSettings.Builder builder)
    {
        ModBiomeDefaultFeatures.addCaves(builder);
        BiomeDefaultFeatures.addDefaultCrystalFormations(builder);
        BiomeDefaultFeatures.addDefaultMonsterRoom(builder);
        BiomeDefaultFeatures.addDefaultUndergroundVariety(builder);
        BiomeDefaultFeatures.addDefaultSprings(builder);
        BiomeDefaultFeatures.addSurfaceFreezing(builder);
    }
	
    //ADD BIOMES
    public static Biome pineSlopes()
    {
		BiomeSpecialEffects effects = new BiomeSpecialEffects.Builder().fogColor(12638463).waterColor(-12619852).waterFogColor(-14007447)
						.skyColor(7972607).foliageColorOverride(-9075130).grassColorOverride(-8083622).build();
    	
        MobSpawnSettings.Builder spawnBuilder = new MobSpawnSettings.Builder();
        BiomeDefaultFeatures.commonSpawns(spawnBuilder);

        BiomeGenerationSettings.Builder biomeBuilder = new BiomeGenerationSettings.Builder();

		biomeBuilder.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, PlacementUtils.register("regions_unexplored:pslope_bush",
				FeatureUtils.register("regions_unexplored:pslope_bush", Feature.TREE, new TreeConfiguration.TreeConfigurationBuilder(
					BlockStateProvider.simple(Blocks.OAK_LOG.defaultBlockState()), new StraightTrunkPlacer(1, 0, 0), BlockStateProvider.simple(Blocks.OAK_LEAVES.defaultBlockState()), 
					new BushFoliagePlacer(ConstantInt.of(2), ConstantInt.of(1), 2), new TwoLayersFeatureSize(0, 0, 0)).build()),
				List.of(CountPlacement.of(1), InSquarePlacement.spread(), SurfaceWaterDepthFilter.forMaxDepth(0),
						PlacementUtils.HEIGHTMAP_OCEAN_FLOOR, PlacementUtils.filteredByBlockSurvival(Blocks.OAK_SAPLING), BiomeFilter.biome())));

         biomeBuilder.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, PlacementUtils.register("regions_unexplored:pslope_sb",
				FeatureUtils.register("regions_unexplored:pslope_sb", Feature.TREE, new TreeConfiguration.TreeConfigurationBuilder(
						BlockStateProvider.simple(Blocks.OAK_LOG.defaultBlockState()), new StraightTrunkPlacer(6, 3, 0),
						BlockStateProvider.simple(Blocks.OAK_LEAVES.defaultBlockState()),
						new BlobFoliagePlacer(ConstantInt.of(2), ConstantInt.of(0), 3), new TwoLayersFeatureSize(1, 0, 1)).ignoreVines().build()),
				List.of(CountPlacement.of(1), InSquarePlacement.spread(), SurfaceWaterDepthFilter.forMaxDepth(0),
						PlacementUtils.HEIGHTMAP_OCEAN_FLOOR, PlacementUtils.filteredByBlockSurvival(Blocks.OAK_SAPLING), BiomeFilter.biome())));

		 biomeBuilder.addFeature(GenerationStep.Decoration.VEGETAL_DECORATION, PlacementUtils.register("regions_unexplored:pslope_pine",
				FeatureUtils.register("regions_unexplored:pslope_pine", Feature.TREE, new TreeConfiguration.TreeConfigurationBuilder(
					BlockStateProvider.simple(RegionsUnexploredModBlocks.PINE_LOG.get().defaultBlockState()), new StraightTrunkPlacer(8, 2, 2), 
				BlockStateProvider.simple(RegionsUnexploredModBlocks.PINE_LEAVES.get().defaultBlockState()), new SpruceFoliagePlacer(UniformInt.of(2, 3), UniformInt.of(2, 2), UniformInt.of(5, 5)), 
				new TwoLayersFeatureSize(2, 0, 2)).ignoreVines().build()),
				List.of(CountPlacement.of(7), InSquarePlacement.spread(), SurfaceWaterDepthFilter.forMaxDepth(0),
						PlacementUtils.HEIGHTMAP_OCEAN_FLOOR, PlacementUtils.filteredByBlockSurvival(Blocks.OAK_SAPLING), BiomeFilter.biome())));
						  
        
        globalOverworldGeneration(biomeBuilder);
        BiomeDefaultFeatures.addDefaultOres(biomeBuilder);
        BiomeDefaultFeatures.addDefaultSoftDisks(biomeBuilder);
        return new Biome.BiomeBuilder().precipitation(Biome.Precipitation.RAIN).biomeCategory(Biome.BiomeCategory.TAIGA).temperature(0.5f)
				.downfall(0.7f).specialEffects(effects).mobSpawnSettings(spawnBuilder.build()).generationSettings(biomeBuilder.build())
				.build();

    }
}

and here is where it is registry name is made

public class ModBiomes
{
    @SubscribeEvent
    public static void registerBiomes(RegistryEvent.Register<Biome> event)
    {
        IForgeRegistry<Biome> registry = event.getRegistry();
        registry.register(OverworldBiomes.pineSlopes().setRegistryName(ModdedBiomes.PINE_SLOPES.location()));
      }
}

resource key here

public class ModdedBiomes
{
    public static final ResourceKey<Biome> PINE_SLOPES = register("pine_slopes");

    private static ResourceKey<Biome> register(String name)
    {
        return ResourceKey.create(Registry.BIOME_REGISTRY, new ResourceLocation("regions_unexplored", name));
    }
}

and makes a Terrablender region here

public class ModRegion extends Region
{
    public ModRegion(ResourceLocation name, int weight)
    {
        super(name, RegionType.OVERWORLD, weight);
    }

    @Override
    public void addBiomes(Registry<Biome> registry, Consumer<Pair<Climate.ParameterPoint, ResourceKey<Biome>>> mapper)
    {
        this.addModifiedVanillaOverworldBiomes(mapper, builder -> {
            
			List<Climate.ParameterPoint> grovePoints = new ParameterPointListBuilder()
                    .temperature(Temperature.COOL, Temperature.NEUTRAL)
                    .humidity(Humidity.ARID, Humidity.DRY, Humidity.NEUTRAL, Humidity.WET, Humidity.HUMID)
                    .continentalness(Continentalness.span(Continentalness.NEAR_INLAND, Continentalness.FAR_INLAND))
                    .erosion(Erosion.EROSION_0, Erosion.EROSION_1)
                    .depth(Depth.SURFACE, Depth.FLOOR)
                    .weirdness(Weirdness.PEAK_NORMAL, Weirdness.PEAK_VARIANT, Weirdness.HIGH_SLICE_VARIANT_ASCENDING, Weirdness.HIGH_SLICE_VARIANT_DESCENDING, Weirdness.HIGH_SLICE_NORMAL_ASCENDING, Weirdness.HIGH_SLICE_NORMAL_DESCENDING, Weirdness.MID_SLICE_VARIANT_ASCENDING, Weirdness.MID_SLICE_VARIANT_DESCENDING, Weirdness.MID_SLICE_NORMAL_ASCENDING, Weirdness.MID_SLICE_NORMAL_DESCENDING)
                    .build();

            grovePoints.forEach(point -> builder.replaceBiome(point, ModdedBiomes.PINE_SLOPES));
        });
    }
}

again i apreciate all the help youve given me. Im gonna try to stumble my way upon a solution.

Edited by UHQ_GAMES
Link to comment
Share on other sites

If you are using TerraBlender then you need to ask them.

  • Thanks 1

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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