Jump to content

[Solved] A block that is affected by gravity but you can also walk through


Recommended Posts

Posted

Disclaimer: So far I've only written small utility mods so I have 0 experience in working with entities, blocks and such, so please bear with me...

 

Basically my goal is to make something like Glowing Orbs that can be thrown like snowballs (that part is already working) and on impact they drop a block or something that has the following properties:

- It emits light once it sits still; achieved by just giving it a lightLevel

- It's affected by gravity like sand or gravel is; achieved by making the block extend BlockFalling

- Now here's the catch: I want to make it so you can walk through it (done by overriding getCollisionBoundingBoxFromPool and returning null) but at the same time that other blocks that fall on it (be it my block or sand, gravel etc) don't get destroyed.

 

I've looked at EntityFallingBlock and BlockFalling and all that but I just can't wrap my head around how I would solve that issue. So any help as to where to begin would be appreciated.

 

Or if you have a different idea on how to approach this I'm all ears. I first tried to fiddle around with just entities that get dropped when the thrown Glowing Orb hits something but from what I understand you need blocks in order to emit light so...

Posted

To allow falling blocks to collide with the block but other entities to pass through it, you need to override

Block#addCollisionBoxesToList

to only call the super method if the

Entity

is an instance of

EntityFallingBlock

.

 

I have an example of this here.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

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.