Posted December 31, 20222 yr I am writing a mod that requires that a block be set as invisible on the client side. My code currently has: BlockPos pos = new BlockPos(x, y, z); BlockState blockState = Minecraft.instance().level.getBlockState(pos); Block block = blockState.getBlock(); but I cannot find a method to make the block invisible. My event listener is: @SubscribeEvent public void onRenderWorld(RenderLevelStageEvent event) I cannot use Minecraft.instance().level.setBlock(block, Blocks.AIR.defaultProperties, 3); as that did not work. The block has to be visible to other players. Edited December 31, 20222 yr by 4rmy
December 31, 20222 yr Sounds to me like you're writing a modern x-ray mod.. 🤨 Whether you actually are or not take a look at this as it pretty much does what you're looking for
December 31, 20222 yr Author I am writing a simple security mod where only the player who placed the block can see it
December 31, 20222 yr If you want to have a block that has custom data (who placed the block) and to change the rendering based on that data then you need a BlockEntity. https://forge.gemwire.uk/wiki/Block_Entities https://forge.gemwire.uk/wiki/Block_Entity_Renderer Boilerplate: If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one. If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install Large files should be posted to a file sharing site like https://gist.github.com You should also read the support forum sticky post.
December 31, 20222 yr Author 51 minutes ago, Novality said: Whether you actually are or not take a look at this as it pretty much does what you're looking for The mod isn't exactly what I am looking for. That mod outlines the blocks. I want to turn the block invisible.
December 31, 20222 yr Author 1 minute ago, warjort said: If you want to have a block that has custom data (who placed the block) and to change the rendering based on that data then you need a BlockEntity. https://forge.gemwire.uk/wiki/Block_Entities https://forge.gemwire.uk/wiki/Block_Entity_Renderer I have an item that, when right clicked on a vanilla block, should turn the block invisible. I am not trying to add a new block, but rather change the existing block.
December 31, 20222 yr Author 58 minutes ago, Novality said: Sounds to me like you're writing a modern x-ray mod.. 🤨 If you have seen an x-ray mod like the one in Meteor client, I am trying to do the same effect, but I am only doing it to certain blocks. See image: Edited December 31, 20222 yr by 4rmy
December 31, 20222 yr There is no way to change the rendering for normal blocks individually (beyond major hacks to the game that would likely cause compatiblity problems). They are all really the same block, just drawn in different places on the screen. Edited December 31, 20222 yr by warjort Boilerplate: If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one. If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install Large files should be posted to a file sharing site like https://gist.github.com You should also read the support forum sticky post.
December 31, 20222 yr Author Thank you for your help! I was originally using chatGPT3 to try and find a method but it fell into a hole. If there is no way then I will try to find a different goal to achieve.
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.