Jump to content

Inconstancies with Entity getHeight()


Recommended Posts

Posted (edited)

I'm having trouble with the Entity getHeight() method returning the wrong value.

Here's my code:

RS2Object patch = getObjects().closest(p -> IntStream.of(p.getModelIds()).anyMatch(i -> i == 7768));
if (patch != null) {
	if (patch.getHeight() < 80) {
		// Plant Seed Code
	} else {
		// Water Code
	}
}
  

The problem is after the seed is planted I'm still getting 0 back for the height when is should now be 80 - this doesn't seem to be constant however as sometimes I'm getting the correct result. If I use the debug on the client I can see that the height is in-fact 80.

Am I just doing something stupid here or is this a client bug?

Edited by Ragnar Lothbrok
Posted

There may be a different RS2Object instance for every tile of the patch, even multiple ones on the same tile and only one visible representing the current growth cycle of the patch. That's just an idea of what to look for, I doubt that's the problem but I'm saying you should check how many of those entities are actually there and look at their properties and how they change when the seed is planted (through code).

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...