Jump to content

Recommended Posts

Posted

I have my TESR's rendering axises, which extend out of the block.

 

This is the code i use for a single axis: https://github.com/Wuerfel21/The-Derpy-Shiz-Mod/blob/master/src/main/java/net/wuerfel21/derpyshiz/entity/tile/AbstractGearbox.java#L41-L59

 

Now i tried adapting it for 2 axises: https://github.com/Wuerfel21/The-Derpy-Shiz-Mod/blob/master/src/main/java/net/wuerfel21/derpyshiz/entity/tile/TileEntityGearboxSplitting.java#L145-L181

 

but it seems to cover only the block itself...

Posted

There isnt much to show, it just has the default render bounding box, e.g. when the actual block is offscreen, all stuff extending from it isnt rendered...

(BTW the first method works, but the lower one(which is for 2 axises) shows the above symptoms)

Posted

Hi

 

Try this

 

TileEntity::
/** Return an appropriate bounding box enclosing the TESR
 * This method is used to control whether the TESR should be rendered or not, depending on where the player is looking.
 * The default is the AABB for the parent block, which might be too small if the TESR renders outside the borders of the
 *   parent block.
 * If you get the boundary too small, the TESR may disappear when you aren't looking directly at it.
 * @return an appropriately size AABB for the TileEntity
 */
@SideOnly(Side.CLIENT)
@Override
public AxisAlignedBB getRenderBoundingBox()
{
	// if your render should always be performed regardless of where the player is looking, use infinite
	AxisAlignedBB infiniteExample = INFINITE_EXTENT_AABB;

	// our gem will stay above the block, up to 1 block higher, so our bounding box is from [x,y,z] to  [x+1, y+2, z+1]
	AxisAlignedBB aabb = new AxisAlignedBB(getPos(), getPos().add(1, 2, 1));
	return aabb;
}

 

(What I mean is - try it with an infinite box.  If that fixes your problem, your bounding box is wrong - try setting a breakpoint or System.out.println in there  to see why)

 

This link might also be of interest

https://github.com/TheGreyGhost/MinecraftByExample/tree/master/src/main/java/minecraftbyexample/mbe21_tileentityspecialrenderer

 

-TGG

 

 

Posted

I already knew it was the bounding box, it was the only thing i changed.

 

So, again:

First metod works perfectly, but only accounts for 1 axis

Second method should do for 2 axises, but does only have the block itself in the bounding box, which is the problem

Posted

I already knew it was the bounding box, it was the only thing i changed.

 

So, again:

First metod works perfectly, but only accounts for 1 axis

Second method should do for 2 axises, but does only have the block itself in the bounding box, which is the problem

> try setting a breakpoint or System.out.println in there  to see why)

I guess you didn't try this suggestion?

 

eg

System.out.println("b1: " + b1);
System.out.println("b2:" + b2);
AxisAlignedBB retval = b1.func_111270_a(b2);
System.out.println("b1xb2:" + retval);
	return b1.func_111270_a(b2);

If you do this, you'll find out pretty quickly that your switches are busted.

 

-TGG

 

 

 

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.