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.

Adding Bounding Boxes (not block bounds, more than that) [SOLVED] [1.7.10]

Featured Replies

Posted

Hello everyone.

 

So I a playing with block bounds again, but this time, instead of bounds larger than 1x1x1, I am trying to add bounding boxes to a cable I am working on, so I have it rendering and connecting, but the block bounds aren't updating, and this is because I haven't made it do so yet (because I don't know how to do this, hence why I am coming here).

 

So I would like to ADD bounding boxes when it is connected, don't confuse this, I want to ADD boxes, not extend the existing box. like what Buildcraft pipes do, they add boxes, and don't just extend the box existing. Now I have come across a method called addCollisionBoxesToList(world, x, y, z, AABB, list, entity) {...} and have filled it out:

        public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB block, List list, Entity entity) { 

	float px = 1/16;

	this.setBlockBounds(px*6-2, px*6-2, px*6-2, px*6-2, px*6-2, px*6-2);
	super.addCollisionBoxesToList(world, x, y, z, block, list, entity); 

	TileEntity tileEntity = world.getTileEntity(x, y, z); 
	if (tileEntity instanceof TileEntityCable) { 
		TileEntityCable tileCable = (TileEntityCable) tileEntity; 

		if (tileCable.connections[5] != null) { 
			this.setBlockBounds(0.0F, 0.375F, 0.375F, 0.625F, 0.625F, 0.625F);
			super.addCollisionBoxesToList(world, x, y, z, block, list, entity); 
		} if (tileCable.connections[4] != null) { 
			this.setBlockBounds(0.375F, 0.375F, 0.375F, 1.0F, 0.625F, 0.625F);
			super.addCollisionBoxesToList(world, x, y, z, block, list, entity); 
		} if (tileCable.connections[1] != null) { 
			this.setBlockBounds(0.375F, 0.0F, 0.375F, 0.625F, 0.625F, 0.625F);
			super.addCollisionBoxesToList(world, x, y, z, block, list, entity); 
		} if (tileCable.connections[0] != null) { 
			this.setBlockBounds(0.375F, 0.375F, 0.375F, 0.625F, 1.0F, 0.625F);
			super.addCollisionBoxesToList(world, x, y, z, block, list, entity); 
		} if (tileCable.connections[2] != null) { 
			this.setBlockBounds(0.375F, 0.375F, 0.0F, 0.625F, 0.625F, 0.625F);
			super.addCollisionBoxesToList(world, x, y, z, block, list, entity); 
		} if (tileCable.connections[3] != null) { 
			this.setBlockBounds(0.375F, 0.375F, 0.375F, 0.625F, 1.0F, 0.625F);
			super.addCollisionBoxesToList(world, x, y, z, block, list, entity); 
		}
	}
	this.setBlockBounds(0.375F, 0.375F, 0.375F, 0.625F, 0.625F, 0.625F);
}

Now all this seems to do is set the collision boxes, not the actual bounds. so before this, I could clip through the sections of the cable without bounds, and the same with other entities, now with this, it seems to stop that, but still no bounding boxes. Also, just a little note, the "connections" is a ForgeDirection array in the tileentity used to store the connections.  (0 = UP, 1 = DOWN, 2 = NORTH, 3 = SOUTH, 4 = EAST, 5 = WEST).

 

The reason I want to do this, is because I would like to work my cables into forge multipart, so I can have a cable in the same block space as a multipart.

 

So any help on the adding block bounds bit would be appreciated, I would also appreciate help with the multipart bit, but that isn't what this topic is about, and I haven't even got to starting that yet.

 

Thanks

I ask complicated questions, and apparently like to write really long detailed posts. But I also help others when I can.

  • Author

Update: I just discovered that it hasn't actually set the collision box, it was just my perspective, and so the existing bounds was still in my way.

I ask complicated questions, and apparently like to write really long detailed posts. But I also help others when I can.

  • 2 months later...

Hello I have been looking all over for this, I have been working with MCreator and Techne making a door.

I don't know much java hardly only the basics and jumping in to MCreator was the best thing for me to do because I can learn most of the basic block code and such that was and its all generated but for I am becoming a bit more advanced and trying to learn more things, It took me 48 hours just to find what this post, will you help me?

 

May I please ask to see the finished code, this would take a lot of stress of my solders.

If you don't want to post it here you may email it to me at [email protected]

 

Thank you for your time,

NorthWestTrees

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.