Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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

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

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

  • Author

I am writing a simple security mod where only the player who placed the block can see it

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.

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

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

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

Edited by 4rmy

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.

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

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.