Jump to content

chxr

Members
  • Posts

    42
  • Joined

  • Last visited

  • Days Won

    1

chxr last won the day on April 24

chxr had the most liked content!

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

chxr's Achievements

Tree Puncher

Tree Puncher (2/8)

1

Reputation

  1. So im full into world generation right now, carving shit for a dimension I'm doing. I understand what the CarvingMask is, if i understand correctly, an array of bits that, for each chunk, marks wether the block the bit represent is (1) or isn't (0) carved. But I'm not seeing what uses it can have. Under what circumstances is good to make and keep track of a carvingmask?
  2. Yes, it is possible. You should develop the API as a separate project. Wether you want your mod to have the API integrated or have a dependency on it is up to you. I'd say that for testing the API integration, you should have it separated and add it as a dependency to your mod (at least, thats how I've done it in the past). I recall there is also option to compile different parts of your project on different jars. Either way, thats more of a forgegradle question, if i understand it correctly
  3. Yeah I had a similar idea, at some point I also just got the numBlocksCorrupted++ out of the if block so it would just do a loop numBlocksCorrupted amount of times but it still caused some troubles. I've ended up using an extra feature to generate the blob around the ore and its working wonders so I won't be scratching my head much longer with it
  4. I think i've found a more "generation friendly way" of generating random blobs of mineral around the ore. This both does the trick and make the generation work flawlessly (albeit i need to make some adjustments). I just ended up thinking "MAYBE there is another Feature I can use to place the minerals instead of doing it manually" And, low and behold, SCATTERED_ORE is actually a thing. I don't really know how "orthodox" this solution is, but it works and rids me of all the problems I had witht my original "manual" implementation. If anybody has any insight on why my original class could've been causing lag to the point of freezes and chunk generation just refusing to keep loading new chunks, I'm also all ears: Here is the full if (placed) block for anyone with a smiliar issue: if (placed) { // Define the block to replace surrounding blocks with BlockState surroundingBlockState = BlockInit.ABERRANT_MINERALOID.get().defaultBlockState(); RuleTest stoneReplacement = new TagMatchTest(BlockTags.STONE_ORE_REPLACEABLES); //Tag which indicates ores that can replace stone RuleTest deepslateReplacement = new TagMatchTest(BlockTags.DEEPSLATE_ORE_REPLACEABLES); //Tag which indicates ores that can replace deepslate // Create a list of TargetBlockState for the Aberrant Mineraloids List<OreConfiguration.TargetBlockState> targets = new ArrayList<>(); targets.add(OreConfiguration.target(stoneReplacement, surroundingBlockState)); targets.add(OreConfiguration.target(deepslateReplacement, surroundingBlockState)); // Create a new OreConfiguration for the Aberrant Mineraloids OreConfiguration mineraloidConfig = new OreConfiguration(targets, 9); // vein size // Create a new context for the Aberrant Mineraloids FeaturePlaceContext<OreConfiguration> mineraloidCtx = new FeaturePlaceContext<>( Optional.empty(), world, ctx.chunkGenerator(), ctx.random(), offsetOrigin, mineraloidConfig ); // Generate the Aberrant Mineraloids using the SCATTERED_ORE configuration boolean mineraloidsPlaced = Feature.SCATTERED_ORE.place(mineraloidCtx); }
  5. Ok so this specific code freezes the game on world creation. This is what gets me so confused, i get that it might not be the best thing, but is it really so generation heavy?
  6. I've tested the same code on three different envionrments (Desktop win10, desktop Linux and Laptop Linux) and it kinda blows up all the same. Gonna try this code and see if i can tune it
  7. So i have a custom ore and, arround the ore, a bunch of randomly placed custom stone blocks should be placed. After applying it, i've found that it causes moderate to extreme world generation lag (new chunks refusing to load after moving for a while, height slices of the same chunk appearing and disappearing as I get into them instead of the usual long continous chunk, new chunks generating extremely close to me instead of to the set render distance...) I've been debugging for a while and I know for a fact this is causing the lag (and sometimes freeze of the world loading screen on a new world and/or the saving world screen when quitting), since comenting it just makes the worldgen work as usual and I want to see if its really that computationally expensive, if there are other ways of doing it or if the process can be simplfied or optimized. I've tried a lot of combinations for the same code but I am just stuck. Is it some kind of generation cascading im missing? Here is the code for the class. The code inside the if (placed) is the one causing this mess. I can see that the code might not be the most optimized thing, but it does what's supposed to... but at the cost of causing all this. Any tips? package es.nullbyte.relativedimensions.worldgen.oregen.oreplacements; import es.nullbyte.relativedimensions.blocks.BlockInit; import es.nullbyte.relativedimensions.blocks.ModBlockTags; import net.minecraft.core.BlockPos; import net.minecraft.world.level.WorldGenLevel; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext; import net.minecraft.world.level.levelgen.feature.OreFeature; import net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration; import java.util.Optional; public class AberrantOreFeature extends OreFeature { public AberrantOreFeature() { super(OreConfiguration.CODEC); } @Override public boolean place(FeaturePlaceContext<OreConfiguration> ctx) { // Get the world and the position from the context WorldGenLevel world = ctx.level(); BlockPos origin = ctx.origin(); // Offset the origin by 8 in the x and z directions to avoid cascading chunk generation BlockPos offsetOrigin = origin.offset(8, 0, 8); // Create a new context with the offset origin FeaturePlaceContext<OreConfiguration> offsetCtx = new FeaturePlaceContext<>( Optional.empty(), world, ctx.chunkGenerator(), ctx.random(), offsetOrigin, ctx.config() ); // Generate the entire vein of ore at the offset origin boolean placed = super.place(offsetCtx); // If the vein was generated successfully if (placed) { // Define the block to replace surrounding blocks with BlockState surroundingBlockState = BlockInit.ABERRANT_MINERALOID.get().defaultBlockState(); // Generate a random size for the area of corruption int areaSizeX = ctx.random().nextInt(3) + 1; // between 1 and 4 int areaSizeY = ctx.random().nextInt(3) + 1; // between 1 and 4 int areaSizeZ = ctx.random().nextInt(3) + 1; // between 1 and 4 // Calculate the number of blocks to be corrupted based on the area size double numBlocksToCorrupt = (areaSizeX + areaSizeY + areaSizeZ / 2.0) ; // Counter for the number of blocks corrupted int numBlocksCorrupted = 0; // Loop for each block to be corrupted while (numBlocksCorrupted < numBlocksToCorrupt) { // Generate a random position within the area, using the offset origin BlockPos randomPos = offsetOrigin.offset( ctx.random().nextInt(2 * areaSizeX + 1) - areaSizeX, // between -areaSize and areaSize ctx.random().nextInt(2 * areaSizeY + 1) - areaSizeY, ctx.random().nextInt(2 * areaSizeZ + 1) - areaSizeZ ); // If the block at the random position is in the IS_ORE_ABERRANTABLE tag, replace it if (world.getBlockState(randomPos).is(ModBlockTags.STONE_ABERRANTABLE)) { world.setBlock(randomPos, surroundingBlockState, 2); numBlocksCorrupted++; } } } return placed; } }
  8. Here is a tutorial from this same forum that I tried and kinda made work. Take into account that you will have to manage the offset (like rotation, and the offset relative to things like the main hand, offhand etc) by yourself and that can get very troublesome at times.
  9. Ok so: Two things to note: It got stuck due to my dimension type. It was previously the same as the overworld dimension tpye but after changing it , it didn't freeze during spawn generation. ALSO, APPARENTLY, the way I'm doing things, the game can't have two extremely-rich dimensions or it will make the new chunk generation be veeery VEEERY slow. I'm doing the dimension file genreation all in the data generation step now, so it's all good. Mostly. If anybody has any tips regarding how can i more efficently generate a biome-rich dimension, im all ears.
  10. Now it gets stuck at "Preparing start region for dimension overworld" once i was able to generate a full customzied json. Any insights?
  11. I need help understanding if this is possible. As i understand it, modifying the actual overworld is harder and requires 3rd party plugins or using mixins to inject the new biomes, but im not looking for that. I need to make a new dimension that is a copy of the overworld - but with some other custom biomes. I've tried making a copy of the 30k biome list of the regular overworld with my own biomes patched after. It does make my biome spawn, but it does it high up in the air, far away from the actual terrain so no actual physical terrain is ever affected by it. I ignore if this is due to the parameters i give to the biomes and / or if there is an easier way to do it or if im doing it correctly or if its possible overall. I've tried using the overworld template and injecting the rest of biomes via terrablender, but didn't get anything neither. Any tips? EDIT: I was thinking to make a customc lass extending whatever the game uses to generate biomes, but I still understand shit about the world generation code (Hell, i think i understand x10 times better the underlaying mathematical implementation at this point) I understand MultiNoiseBiomeSource and OverworldBiomeBuilder play a part in this (NoiseBasedChunkGenerator and NoiseGenerationSettings too) but on my mother I im failing to understand what can i change to make it, if its even possible.
  12. Last month i was tinkering with terrablender but decided to drop the dependency altogether, since I mainly wanted it to inject new biomes on the overworld and I dont need that anymore. I made a custom dimension, but I forgot the fact that Terrablender was also managing the injection of the custom surface rules I had set. Is there a way (programatically via a data generator or otherwise manually in the resources) to have new surface rules to change the surface appearance of my biomes? I lost track of whatever the hell happened on 1.18 and all I found was "Yeah support for the new surface rules is a TODO for forge team". Was that ever developed? Do i just not complicate it and just go back to have TB as a dependency? Any other not-that-hard way?
  13. Changing the event to RenderGuiEvent.post kinda did the trick. If there is any more suitable events please tell me, and thanks for the help!
  14. Yeah i had something similar and the same problem is happening:It only triggers when in a gui (pause menu, inventory etc) is on the screen. So that was my main need of help. Do i need to make "a class to render the effect on", if that makes sense? Thanks for the render code though, with a few tweaks it will look amazing. EDIT: If im not mistaken that's the expected result of the event used? But as I said this is my first time tinkering with player-side rendering.
  15. So i know for a fact this has been asked before but Render stuff troubles me a little and i didnt find any answer for recent version. I have a custom nausea effect. Currently i add both my nausea effect and the vanilla one for the effect. But the problem is that when I open the inventory, both are listed, while I'd only want mine to show up (both in the inv and on the GUI) I've arrived to the GameRender (on joined/net/minecraft/client) and also found shaders on client-extra/assets/minecraft/shaders/post and client-extra/assets/minecraft/shaders/program but I'm lost. I understand that its like a regular screen, where I'd render stuff "over" the game depending on data on the server, but If someone could point to the right client and server classes that i can read to see how i can manage this or any tip would be apreciated
×
×
  • Create New...

Important Information

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