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 trying to figure out how to make a block where some mobs can pass through it where others cannot.

 

Unless someone knows of a better way, I am guessing I have to handle this somehow with this method:

public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entity)
{
	if(entity instanceof EntityMob)
	{
		// do something here
	}
}

 

I don't have a very good understanding of EnumFacing if that has to be used and would have to need some explanation on how to use it here.

 

I would also like to make this block so all mobs (not just a select few) cannot see through it. It seems if a block is passable in any way, a mob can see through it. Can I prevent them from seeing through a passable block?

  • Author

Thanks! So with your suggestion I came up with this and it seems to work as desired:

@Override //Depreciated
public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, @Nullable Entity entity, boolean p_185477_7_)
{
	if(!(entity instanceof TamablePokemon) && !(entity instanceof EntityPlayer))
	{
		AxisAlignedBB axisalignedbb = state.getBoundingBox(worldIn, pos).offset(pos);

		if (entityBox.intersectsWith(axisalignedbb))
		{
			collidingBoxes.add(axisalignedbb);
		}
	}
}

 

Should I be at all concerned that this Method is marked as Depreciated? Like, it getting removed in a future update?

1 hour ago, FuzzyAcornIndustries said:

Should I be at all concerned that this Method is marked as Depreciated? Like, it getting removed in a future update?

Basically not really. The method is marked deprecated which means do not call this method. You should still override it to get the desired behavior.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

  • Author
4 minutes ago, Draco18s said:

Basically not really. The method is marked deprecated which means do not call this method. You should still override it to get the desired behavior.

Thanks, I was hoping that was the case rather than it was a warning assuring it was gonna be removed. I'm trying to think ahead for scalability into future updates.

The functionailiy will continue to exist as Minecraft evolves, but it is possible that the method does get removed and placed somewhere else. It will depend on how Mojang continues to work with the IBlockState format.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

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.