Posted September 7, 20169 yr Hi! I want to change villages structures blocks depending on the coordinates. Is there a Forge event I can use for this? I know there is GetVillageBlockID but there is no access to the coordinates from this event. Thanks in advance
September 7, 20169 yr Author That's a bummer... What about structures in general, is there anyway to get the coordinates of generated structures?
September 9, 20169 yr Author I may have found a solution, but I need to find a way to know if a village is done generating. Is there an event for that ? Or something else I can use ?
September 9, 20169 yr Author It's kinda working, here's what I've done: private BlockPos pos; private boolean hasChanged = false; private UBBiome currentBiome; // UB stones biomes, not minecraft biomes! @SubscribeEvent public void initMapGen(InitMapGenEvent event) { if (event.getType() == EventType.VILLAGE) { event.setNewGen(new MapGenVillage() { @Override public StructureStart getStructureStart(int chunkX, int chunkZ) { LOGGER.debug("Village start in chunk: " + chunkX + ";" + chunkZ); pos = new BlockPos(chunkX * 16, 0, chunkZ * 16); hasChanged = true; return super.getStructureStart(chunkX, chunkZ); } }); event.setResult(Result.DENY); } } @SubscribeEvent public void onVillageSelectBlock(GetVillageBlockID event) { IBlockState originalState = event.getOriginal(); Block originalBlock = originalState.getBlock(); if (hasChanged) { currentBiome = // getting the biome at pos... hasChanged = false; } // replace blocks if (originalBlock == Blocks.COBBLESTONE) { event.setReplacement(...); event.setResult(Result.DENY); } // ... } The problem is that Minecraft don't call StructureVillagePieces.Village#getBiomeSpecificBlockState for all block of the structures. For example in StructureVillagePieces.Church#addComponentParts: IBlockState iblockstate = Blocks.COBBLESTONE.getDefaultState(); // Cobble is not replaced for Churches IBlockState iblockstate1 = this.getBiomeSpecificBlockState(Blocks.STONE_STAIRS.getDefaultState().withProperty(BlockStairs.FACING, numFacing.NORTH)); IBlockState iblockstate2 = this.getBiomeSpecificBlockState(Blocks.STONE_STAIRS.getDefaultState().withProperty(BlockStairs.FACING, EnumFacing.WEST)); IBlockState iblockstate3 = this.getBiomeSpecificBlockState(Blocks.STONE_STAIRS.getDefaultState().withProperty(BlockStairs.FACING, EnumFacing.EAST)); I think Forge should just patch this by replacing the first line like the ones below it, It won't break anything. If not I will use reflection but I may need some help.
September 15, 20169 yr Author This is a real problem, GetVillageBlockID is not usable because it is called for half the blocks. It's stupid... Can the Forge team edit Minecraft code ? It's about ten lines to change, and I can help, just tell me where to go.
September 15, 20169 yr This is a real problem, GetVillageBlockID is not usable because it is called for half the blocks. It's stupid... Can the Forge team edit Minecraft code ? It's about ten lines to change, and I can help, just tell me where to go. Put in a pull request on forges github, i do not know if they will accept it or not. VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
September 16, 20169 yr Author Thank you! Should I edit the existing patch file ? Or make a new one beside? I'm not really comfortable with those. Also if I rename the variables (iblockstate1,2,3...) should I do it in the patch file or there is a place for it? I'm asking because I saw the processing of Minecraft sources is very ordered and complex.
September 16, 20169 yr Thank you! Should I edit the existing patch file ? Or make a new one beside? I'm not really comfortable with those. Also if I rename the variables (iblockstate1,2,3...) should I do it in the patch file or there is a place for it? I'm asking because I saw the processing of Minecraft sources is very ordered and complex. Make it in code aka .java syntax. VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator.
September 16, 20169 yr Author How can I make a pull request with a file that doesn't exist in the repo? I mean where do I put it? The Minecraft source are not in the repo, only patches. Maybe I should open an issue instead and put the file in a gist?
September 17, 20169 yr Author Ok I ran genPatches and it included my changes in the patch file. I was trying too do it manually...
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.