Jump to content

AwesomeDev

Members
  • Posts

    4
  • Joined

  • Last visited

AwesomeDev's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Minecraft version? Mod loader?
  2. Your mod is probably lagging during world generation due to how it replaces blocks around your custom ore. Right now, it randomly picks spots around the ore and changes blocks there. This process can be slow, especially if it's dealing with lots of blocks or a big area. To fix it, try replacing fewer blocks, picking spots more efficiently, and changing blocks in a smarter way. This should help your mod run smoother when generating worlds. Here is an example of how you can do this // Inside the if (placed) block if (placed) { BlockState surroundingBlockState = BlockInit.ABERRANT_MINERALOID.get().defaultBlockState(); int veinSize = ctx.config().size; int maxBlocksToReplace = (int) Math.ceil(veinSize * 0.1); // Replace 10% of vein size int numBlocksToCorrupt = Math.min(maxBlocksToReplace, 1000); // Limit to 1000 blocks List<BlockPos> positionsToReplace = new ArrayList<>(); // Loop until reaching the limit of blocks to replace while (positionsToReplace.size() < numBlocksToCorrupt) { BlockPos randomPos = offsetOrigin.offset( ctx.random().nextInt(2 * areaSizeX + 1) - areaSizeX, ctx.random().nextInt(2 * areaSizeY + 1) - areaSizeY, ctx.random().nextInt(2 * areaSizeZ + 1) - areaSizeZ ); if (world.getBlockState(randomPos).is(ModBlockTags.STONE_ABERRANTABLE)) { positionsToReplace.add(randomPos); } } // Replace blocks in bulk for (BlockPos pos : positionsToReplace) { world.setBlock(pos, surroundingBlockState, 2); } } If you've tried more effective ways to generate your blocks around your ores, it may also be because of issues on your side, not the mod. Adjust the parameters as needed based on your performance testing and requirements.
  3. Yes, it is quite annoying how there are not any very handy ways to find ways to fix errors, however you can just simply use .of() and specify the properties, here is it used in a example peice of code for a mod I am creating public static final RegistryObject<Block> HYPER_ORE = registerBlock("hyper_ore", () -> new Block(BlockBehaviour.Properties.of().mapColor(MapColor.METAL).instrument(NoteBlockInstrument.IRON_XYLOPHONE).requiresCorrectToolForDrops().strength(5.0F, 6.0F).sound(SoundType.METAL))); Hope this helped for your 1.20.4 mod!
×
×
  • Create New...

Important Information

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