Jump to content

Set block as invisible on client side [1.19]


4rmy

Recommended Posts

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 by 4rmy
Link to comment
Share on other sites

  • 4rmy changed the title to Set block as invisible on client side [1.19]

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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:
143770355-23f099fb-9bf3-4062-9837-e9e9f1

Edited by 4rmy
Link to comment
Share on other sites

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 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.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • So, I started a Forge server which is hosted by cloudnord (don't know it this information is necessary or not). Everything's working fine, the mods are getting loaded, I can join and play on it. Then I wanted to give myself OP. That's where the problems began. I typed "op mc_nicky_com" in the console and just saw, that I automatically disconnected... Weird, I thought and promptly updated the forge version to the client sided version, 47.2.17. Nothing resolved. Thought of downgrading the server to 47.2.0 but still didn't work. Now the server is on 47.2.0 and I can play without OP, which is totally fine but if I want to do something only OPs can do, I have to put it into the console, where I don't have auto-completion. The error it is throwing is the following: io.netty.handler.codec.DecoderException: java.lang.IndexOutOfBoundsException: readerIndex(31613) + length(1) exceeds writerIndex(31613): UnpooledHeapByteBuf(ridx: 31613, widx: 31613, cap: 31613/31613) I don't know how to fix this and I am thankful for every help attempt that comes here.  With best regards nicky.gg
    • Official Website Link ➲➲➲  https://groups.google.com/a/chromium.org/g/chromium-reviews/c/Zyy6WGX5-gA   Product Name ➲➲➲ Keto Candies ACV Gummies It assists with smothering undesirable food desires and close to home dietary patterns.   Official facebook Link ➲➲➲  https://www.facebook.com/KetoCandiesACVGummiesUS/   Official Blogs ➲➲➲ https://groups.google.com/a/chromium.org/g/chromium-reviews/c/4LZAdq7rQSg https://groups.google.com/g/mozilla.dev.platform/c/Uy2KvvUkCbA https://groups.google.com/g/mozilla.dev.platform/c/L-RBHHTlJm0 https://groups.google.com/g/comp.protocols.time.ntp/c/aqbT3woiM9w https://groups.google.com/g/comp.protocols.time.ntp/c/L3J_LIFnET0 https://groups.google.com/a/chromium.org/g/chromium-reviews/c/Zyy6WGX5-gA https://groups.google.com/a/chromium.org/g/chromium-reviews/c/4LZAdq7rQSg https://keto-candies-acv-gummies-2b37b5.webflow.io/ https://keto-candies-acv-gummies-1.jimdosite.com/ https://groups.google.com/g/getketocandiesacvgummies/c/PaSsvPpQsYw https://groups.google.com/g/getketocandiesacvgummies/c/YLKzSrTdeRI   Blue Vibe CBD Gummies Official Links ➲➲➲  https://www.deccanherald.com/brandspot/sponsored-health/blue-vibe-cbd-gummies-reviews-moneyworth-product-or-not-blue-vibe-cbd-gummies-for-sale-consumer-reports-mega-sale-2673730 https://www.facebook.com/GetBlueVibeCBDGummiesUS/ https://www.facebook.com/BlueVibeCBDGummiesUS/ https://www.facebook.com/BlueVibeCBDGummiesInUS/ https://www.facebook.com/events/334310428943928 https://groups.google.com/a/chromium.org/g/chromium-reviews/c/eq2xmAl5Mm4 https://groups.google.com/a/chromium.org/g/chromium-reviews/c/yb2GhvIIBvI Group Google ➲➲  https://groups.google.com/a/chromium.org/g/chromium-reviews/c/LEwhDmgZLHs Group Google ➲➲  https://groups.google.com/a/chromium.org/g/chromium-reviews/c/gREHzPUfMsw Group Google ➲➲  https://groups.google.com/a/chromium.org/g/chromium-reviews/c/FNtpXHp_r7c Group Google ➲➲  https://groups.google.com/a/chromium.org/g/chromium-reviews/c/KqdhsIEuP8k Group Google ➲➲  https://groups.google.com/a/chromium.org/g/chromium-reviews/c/XfZtZqnG-rM Group Google ➲➲ https://groups.google.com/g/comp.os.vms/c/DGXPLV27qCU Group Google ➲➲ https://groups.google.com/g/comp.os.vms/c/t-W4cjZOFSs Group Google ➲➲ https://groups.google.com/g/comp.os.vms/c/i0Ta7Qy4izw
    • Make a test without practical_plushies_mobs, practical_plushies_animals and dark-waters - looks like it is not working with sinytra connector
    • VIP Call Girlfriend in Abu Dhabi ☮➡+971557861567(㎓) Escorts In Abu Dhabi   VIP Call Girlfriend in Abu Dhabi ☮➡+971557861567(㎓) Escorts In Abu Dhabi   VIP Call Girlfriend in Abu Dhabi ☮➡+971557861567(㎓) Escorts In Abu Dhabi
    • Maybe your file codes are missing. Therefore it is crashing.
  • Topics

×
×
  • Create New...

Important Information

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