Jump to content

Skyriis

Members
  • Posts

    176
  • Joined

  • Last visited

Everything posted by Skyriis

  1. oh well, the whole structure is at least 3 chunks long so i probably need to use a custom structure instead of a feature. correct?
  2. alright so i've changed my place method to this: @Override public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> pContext) { BlockPos origin = pContext.origin(); WorldGenLevel level = pContext.level(); StructureTemplateManager templateManager = level.getServer().getStructureManager(); BulkSectionAccess sectionAccess = new BulkSectionAccess(level); // Get structure parts StructureTemplate entranceTemplate = templateManager.getOrCreate(ENTRANCE); StructureTemplate understairTemplate = templateManager.getOrCreate(UNDERSTAIR); StructureTemplate roomTemplate = templateManager.getOrCreate(ROOMS[level.getRandom().nextIntBetweenInclusive(0, ROOMS.length - 1)]); Vec3i entranceSize = entranceTemplate.getSize(); // Ensure we can write in the entrance structure area for (int x = 0; x < entranceSize.getX(); x++) { for (int y = 0; y < entranceSize.getY(); y++) { for (int z = 0; z < entranceSize.getZ(); z++) { if (!level.ensureCanWrite(origin.offset(x, y, z))) return false; } } } // Check top and bottom (front) is covered for (int i = -1; i < entranceSize.getX(); i++) { if (safeBlockStateCheck(sectionAccess, origin.offset(i, -1, 0), BlockBehaviour.BlockStateBase::isAir, true)) return false; if (safeBlockStateCheck(sectionAccess, origin.offset(i, entranceSize.getY(), 0), BlockBehaviour.BlockStateBase::isAir, true)) return false; } // check left and right (front) is covered for (int i = -1; i < entranceSize.getY(); i++) { if (safeBlockStateCheck(sectionAccess, origin.offset(-1, i, 0), BlockBehaviour.BlockStateBase::isAir, true)) return false; if (safeBlockStateCheck(sectionAccess, origin.offset(entranceSize.getX(), i, 0), BlockBehaviour.BlockStateBase::isAir, true)) return false; } // Ensure air is in front of the cave entrance for (int x = 2; x < entranceSize.getX() - 2; x++) { for (int y = 2; y < entranceSize.getY() - 2; y++) { if (safeBlockStateCheck(sectionAccess, origin.offset(x, y, 0), blockState -> !blockState.isAir())) return false; } } boolean entrancePlaceSuccess = entranceTemplate.placeInWorld(level, origin, origin, new StructurePlaceSettings(), level.getRandom(), 2); return false; } private boolean safeBlockStateCheck(BulkSectionAccess sectionAccess, BlockPos pos, Predicate<BlockState> check) { return safeBlockStateCheck(sectionAccess, pos, check, false); } private boolean safeBlockStateCheck(BulkSectionAccess sectionAccess, BlockPos pos, Predicate<BlockState> check, boolean resultWhenInaccessible) { LevelChunkSection chunkSection = sectionAccess.getSection(pos); // Ensure chunk section exists if (chunkSection == null) return resultWhenInaccessible; // Get target block state BlockState targetState = chunkSection.getBlockState( SectionPos.sectionRelative(pos.getX()), SectionPos.sectionRelative(pos.getY()), SectionPos.sectionRelative(pos.getZ()) ); // Return test result return check.test(targetState); } and now i'm getting those errors in the first for loop (the ensure write thing): why is that?
  3. alright so... i got this as my feature: @Override public boolean place(FeaturePlaceContext<NoneFeatureConfiguration> pContext) { BlockPos origin = pContext.origin(); ServerLevel level = pContext.level().getLevel(); StructureTemplateManager templateManager = level.getStructureManager(); // Get structure parts StructureTemplate entranceTemplate = templateManager.getOrCreate(ENTRANCE); StructureTemplate understairTemplate = templateManager.getOrCreate(UNDERSTAIR); StructureTemplate roomTemplate = templateManager.getOrCreate(ROOMS[level.getRandom().nextIntBetweenInclusive(0, ROOMS.length - 1)]); Vec3i entranceSize = entranceTemplate.getSize(); // Check top and bottom entrance for (int i = -1; i < entranceSize.getX(); i++) { BlockState bottomState = level.getBlockState(origin.offset(i, -1, 0)); BlockState topState = level.getBlockState(origin.offset(i, entranceSize.getY(), 0)); // Exit if air if (bottomState.isAir() || topState.isAir()) return false; } // check left and right entrance for (int i = -1; i < entranceSize.getY(); i++) { BlockState leftState = level.getBlockState(origin.offset(-1, i, 0)); BlockState rightState = level.getBlockState(origin.offset(entranceSize.getX(), i, 0)); //Exit if air if (leftState.isAir() || rightState.isAir()) return false; } // Ensure air is in front of the cave entrance for (int x = 1; x < entranceSize.getX() - 1; x++) { for (int y = 1; y < entranceSize.getY() - 1; y++) { if (!level.getBlockState(origin.offset(x, y, -1)).isAir()) return false; } } boolean entrancePlaceSuccess = entranceTemplate.placeInWorld(level, origin, origin, new StructurePlaceSettings(), level.getRandom(), 2); return false; } and the place method get's invoked (i checked that with a break point and the intellij debugger) problem is that the world gen get's stuck When i create a new world it get's stuck here: Any ideas what cause this?
  4. i already got the nbt files but how do i place them in a feature? I got no clue how to check and generate them in the Feature#place method
  5. how would i make a jigsaw structure a feature? or... how would i make a feature 1.19 anyway How would i generate the nbt files (like a jigsaw structure would do it) and then check the size and blocks around?
  6. i'm using the json stuff to generate my structure. i got no clue how i would access the level from that?
  7. Hey Guys, i'm trying to generate my structure only on places which make sense. My Structure is basically a small cave which should only generate on the bottom of hills in the wall. How it looks right now: How it should look: https://prnt.sc/O7A7FfdhneAv How would i do that?
  8. Oh damn I would never have found the error without you thank you so much
  9. Hey Guys, it looks like i broke something in my mod but i got no idea what. This happends if i try to join the `runServer` Server with my `runClient` Client Full Error (Client Side): https://mclo.gs/AjEXFD1 GitHub: https://github.com/ManasMods/reincarnated_mod/tree/dev/smithing-bench Any ideas what could cause that?
  10. Hey Guys, i'm working on a BlockEntity which processes Items into "Molten Material" and one or two Molten Material(s) into a (new) Item. Right now i'm working with custom json files in my data folder for the processing: Molten Material Class: ItemStack -> MoltenMaterial "Recipe" class: MoltenMaterial(s) -> ItemStack "Recipe" class: Screenshots: The thing is... i want to use JEI to display my Recipes but that's only possible if i make the melting and smelting classes to true recipes but i got no clue how to check the "MoltenMaterial" values from the BlockEntity within the Recipe class
  11. Hey Guys, i'm working on grass stairs and struggle a bit on the Model The bottom versions work without a problem but the upside-down version are a bit cursed: How would i fix that tinting issue? Model file: https://github.com/ManasMods/ManasCore/blob/master/src/main/resources/assets/manascore/models/block/overlay_stairs.json
  12. Well, good point. I'm gonna do that in an update. I'm happy if something works somehow ^^" Nice thank you
  13. https://github.com/ManasMods/vanilla_plus
  14. Hey Guys, i'm trying to add a new recipe type (fletching) to my mod and i'm currenty struggling on implementing the crafting system. The result item appears if one ingredient (of multiple) has been inserted and then removed. My Menu: Recipe Serializer: Recipe: test recipe json:
  15. i've checkt the content of the options.txt before and after sync with the cloud and the only difference is the order of the lines. APIHelper class: Handler class:
  16. Hey Guys, I'm working on a mod which allows to store your settings (options.txt) in a cloud service but something seems to cause a weird problem. I'm getting this log message which doesn't really makes sense to me since i'm just copying the values from the options.txt when the Options#save has finished writing and load those values on startup before Options#load once. Has someone an idea what could cause that problem?
  17. Okay i made a boolean and it started the disc but i can't stop it anymore. (i've updated the code above). EDIT nvm i forgot to update the boolean
  18. i should run level.levelEvent(PLAY_RECORD_EVENT, worldPosition, Item.getId(getRecord().getItem())); every tick? Wouldn't that cause the disc to go crasy?
  19. Okay next problem. the blockentity doesn't play anything when i log out and log in again. I guess i have to run the level.levelEvent(PLAY_RECORD_EVENT, worldPosition, Item.getId(getRecord().getItem())); when the blockentity gets loaded but is there a method for that?
  20. i guess that thing get's invoked when i open my container but why? container.addListener((handler, slot) -> { if (slot == 8) { stop(); } setChanged(); }); it should only get invoked if "onContentsChanged" get's called
×
×
  • Create New...

Important Information

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