Jump to content

[1.16.4] How do I make a block connect with adjacent blocks?


Linky132

Recommended Posts

Hi, I'm trying to make a dust-like block (think redstone), but I can't figure out how to make the texture connect with the texture of the block next to it. I tried looking at the RedstoneWireBlock and FourWayBlock classes like someone on the Discord server suggested, but I can't really understand them. I can reuse vanilla redstone's blockstate, but I don't know what to put in the block's class itself. If anyone could give me some pointers or something, I'd really appreciate it. Thanks!

Link to comment
Share on other sites

Well, it's just a lot to take in, and I'm having trouble figuring out which parts I need. I also don't really want to just copy and paste a bunch of code from another class, since I'm not really going to learn from it. Pretty much all of the code in those classes is confusing to me, and barely makes sense, so I'm not really sure what to do.

Link to comment
Share on other sites

I took a look at RedstoneWireBlock and placed some dust in Minecraft to see what's up (you can press F3 and look at the dust to see properties). There's a RedstoneSide enum that can be either NONE, SIDE, or UP. Each side of the block (north, south, east, west) has an associated RedstoneSide value. These side properties are mapped to these enum values in a BlockState (field_235543_o_). Consider a block of redstone dust, Block A. If Block A was not surrounded by any blocks and the dust was pointing in all directions, the NORTH, SOUTH, EAST, and WEST properties would all be SIDE. If there was another redstone dust to the north of Block A, then Block A's NORTH and SOUTH properties would be SIDE, and its EAST and WEST properties would be NONE. If there was a solid block to the north of Block A with a dust on top, then Block A's NORTH property would be UP, its SOUTH property would be SIDE, and its EAST and WEST properties would be NONE. From a quick look it seems like func_235554_l_ builds a shape for each valid block state.

 

You can probably look at the blocks adjacent to yours and set these properties accordingly, then use the properties to change the block state.

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

Announcements



×
×
  • Create New...

Important Information

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