Jump to content

Tyrrel

Members
  • Posts

    3
  • Joined

  • Last visited

Tyrrel's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. I figured it out! Posting relevant code for the future generations below. public class DarkDerpiumBiome extends Biome { public DarkDerpiumBiome(Builder biomeBuilder) { super(biomeBuilder); this.addCarver(GenerationStage.Carving.AIR, Biome.createCarver(new ModCaveCarver(ProbabilityConfig::deserialize), new ProbabilityConfig(0.2f))); DefaultBiomeFeatures.addSedimentDisks(this); DefaultBiomeFeatures.addMushrooms(this); DefaultBiomeFeatures.addSprings(this); this.addSpawn(EntityClassification.AMBIENT, new Biome.SpawnListEntry(EntityType.BAT, 10, 8, 8)); this.addSpawn(EntityClassification.WATER_CREATURE, new Biome.SpawnListEntry(EntityType.SQUID, 2, 1, 4)); } @Mod.EventBusSubscriber(modid = Derpium.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD) @ObjectHolder(Derpium.MOD_ID) public class CarverInit { @SubscribeEvent public static void registerCarver(final RegistryEvent.Register<WorldCarver<?>> event) { event.getRegistry().register(new ModCaveCarver(ProbabilityConfig::deserialize).setRegistryName( "dark_carver")); } } public class ModCaveCarver extends CaveWorldCarver { public ModCaveCarver(Function<Dynamic<?>, ? extends ProbabilityConfig> p_i49929_1_) { super(p_i49929_1_, 138); this.carvableBlocks = ImmutableSet.of(Blocks.BONE_BLOCK, Blocks.STONE); this.carvableFluids = ImmutableSet.of(Fluids.WATER); } @Override protected int generateCaveStartY(Random p_222726_1_) { return p_222726_1_.nextInt(this.maxHeight); } @Override protected int func_222724_a() { return 10; } @Override protected float generateCaveRadius(Random rand) { return (rand.nextFloat() * 2.0F + rand.nextFloat()) * 2.0F; } @Override protected double func_222725_b() { return 5.0D; } @Override protected boolean func_225556_a_(IChunk p_225556_1_, Function<BlockPos, Biome> p_225556_2_, BitSet p_225556_3_, Random p_225556_4_, BlockPos.Mutable p_225556_5_, BlockPos.Mutable p_225556_6_, BlockPos.Mutable p_225556_7_, int p_225556_8_, int p_225556_9_, int p_225556_10_, int p_225556_11_, int p_225556_12_, int p_225556_13_, int p_225556_14_, int p_225556_15_, AtomicBoolean p_225556_16_) { int i = p_225556_13_ | p_225556_15_ << 4 | p_225556_14_ << 8; if (p_225556_3_.get(i)) { return false; } else { p_225556_3_.set(i); p_225556_5_.setPos(p_225556_11_, p_225556_14_, p_225556_12_); if (this.func_222706_a(p_225556_1_.getBlockState(p_225556_5_))) { BlockState blockstate; if (p_225556_14_ <= 31) { blockstate = WATER.getBlockState(); } else { blockstate = CAVE_AIR; } p_225556_1_.setBlockState(p_225556_5_, blockstate, false); return true; } else { return false; } } } }
  2. I moved to using an Object Holder and registry event and that seems to be working a bit better. However, I am now running into a null pointer exception when attempting to load the dimension I have this carver/biome in. @Mod.EventBusSubscriber(modid = Derpium.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD) @ObjectHolder(Derpium.MOD_ID) public class CarverInit { public static final WorldCarver<ProbabilityConfig> dark_carver = null; @SubscribeEvent public static void registerCarver(final RegistryEvent.Register<WorldCarver<?>> event) { event.getRegistry().register(new ModCaveCarver(ProbabilityConfig::deserialize).setRegistryName( "dark_carver")); } } I don't work with Object Holders often, this was just how I did items in the past when I was first learning those. How would I go about calling the registry for my new carver here? public class DarkDerpiumBiome extends Biome { public DarkDerpiumBiome(Builder biomeBuilder) { super(biomeBuilder); this.addCarver(GenerationStage.Carving.AIR, Biome.createCarver(CarverInit.dark_carver, new ProbabilityConfig(0.2f))); DefaultBiomeFeatures.addSedimentDisks(this); DefaultBiomeFeatures.addMushrooms(this); DefaultBiomeFeatures.addSprings(this); this.addSpawn(EntityClassification.AMBIENT, new Biome.SpawnListEntry(EntityType.BAT, 10, 8, 8)); this.addSpawn(EntityClassification.WATER_CREATURE, new Biome.SpawnListEntry(EntityType.SQUID, 2, 1, 4)); } As for posting my debug.log, it appears to be too large to use pastebin and I am unable to attach it here. Suggestions?
  3. I've been having trouble figuring out how to correctly register a custom CaveWorldCarver for 1.15.2. I'm using Deferred Registries. public class CarverInit { public static final DeferredRegister<WorldCarver<?>> CARVERS = new DeferredRegister<>( ForgeRegistries.WORLD_CARVERS, Derpium.MOD_ID); public static final RegistryObject<WorldCarver<ProbabilityConfig>> DARK_CARVER = CARVERS.register("dark_carver", () -> new ModCaveCarver(ProbabilityConfig::deserialize)); } Am I doing this incorrectly, or are there more steps that should be followed? I have the necessary reference in my main class, and have moved that around as well to no avail. Minecraft keeps giving me "Registry Object not found" errors when I attempt to use this in a biome.
×
×
  • Create New...

Important Information

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