Jump to content

How to make a block that mobs of a certain type can't walk over?


AskHow1248

Recommended Posts

I think you may be making this harder on yourself. All you need is an invisible block to occupy the block position above the block.

 

We already went through this idea -- the problem is that would block all entities, including players.  He wants to only block certain mobs from crossing.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

jabelar,

 

I think this 'addCollisionBoxesToList' might change that.  I've never looked into it before.  Have you?

 

I did a quick call Heirarchy search and it might actually work. 

 

It won't work for preventing a mob from walking over a block.  It does look like it could prevent a mob from walking through a certain type of block.

Long time Bukkit & Forge Programmer

Happy to try and help

Link to comment
Share on other sites

I think you may be making this harder on yourself. All you need is an invisible block to occupy the block position above the block.

 

We already went through this idea -- the problem is that would block all entities, including players.  He wants to only block certain mobs from crossing.

Overriding the addCollisionBoxToList will allow you to selectively block things. Look at the code I posted.

Also, the vanilla Pathfinding will path around  the invisible blocks, as they are stacked 2 high, as well. The only real caveat is if you bury the block, in a hole, the mob could walk over the invisible blocks, but i would call that user error, as they aren't using the block right. You could even add a simple check for such a thing to prevent placing if their is no block 3 blocks above where it is placed or something.

Link to comment
Share on other sites

I think you may be making this harder on yourself. All you need is an invisible block to occupy the block position above the block.

 

We already went through this idea -- the problem is that would block all entities, including players.  He wants to only block certain mobs from crossing.

Overriding the addCollisionBoxToList will allow you to selectively block things. Look at the code I posted.

Also, the vanilla Pathfinding will path around  the invisible blocks, as they are stacked 2 high, as well. The only real caveat is if you bury the block, in a hole, the mob could walk over the invisible blocks, but i would call that user error, as they aren't using the block right. You could even add a simple check for such a thing to prevent placing if their is no block 3 blocks above where it is placed or something.

 

Okay, after looking into it I agree.  In your original post you should have pointed out what you were really suggesting -- you made it sound like you were simply putting invisible blocks above.  The trick is that these have dynamic bounding boxes.

 

Very cool trick.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

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.