Merge remote-tracking branch 'runelite/master'

This commit is contained in:
Owain van Brakel
2022-05-15 23:01:04 +02:00
7 changed files with 54 additions and 44 deletions

View File

@@ -236,24 +236,28 @@ public class WorldPoint
// find instance chunks using the template point. there might be more than one.
List<WorldPoint> worldPoints = new ArrayList<>();
final int z = worldPoint.getPlane();
int[][][] instanceTemplateChunks = client.getInstanceTemplateChunks();
for (int x = 0; x < instanceTemplateChunks[z].length; ++x)
for (int z = 0; z < instanceTemplateChunks.length; z++)
{
for (int y = 0; y < instanceTemplateChunks[z][x].length; ++y)
for (int x = 0; x < instanceTemplateChunks[z].length; ++x)
{
int chunkData = instanceTemplateChunks[z][x][y];
int rotation = chunkData >> 1 & 0x3;
int templateChunkY = (chunkData >> 3 & 0x7FF) * CHUNK_SIZE;
int templateChunkX = (chunkData >> 14 & 0x3FF) * CHUNK_SIZE;
if (worldPoint.getX() >= templateChunkX && worldPoint.getX() < templateChunkX + CHUNK_SIZE
&& worldPoint.getY() >= templateChunkY && worldPoint.getY() < templateChunkY + CHUNK_SIZE)
for (int y = 0; y < instanceTemplateChunks[z][x].length; ++y)
{
WorldPoint p = new WorldPoint(client.getBaseX() + x * CHUNK_SIZE + (worldPoint.getX() & (CHUNK_SIZE - 1)),
client.getBaseY() + y * CHUNK_SIZE + (worldPoint.getY() & (CHUNK_SIZE - 1)),
worldPoint.getPlane());
p = rotate(p, rotation);
worldPoints.add(p);
int chunkData = instanceTemplateChunks[z][x][y];
int rotation = chunkData >> 1 & 0x3;
int templateChunkY = (chunkData >> 3 & 0x7FF) * CHUNK_SIZE;
int templateChunkX = (chunkData >> 14 & 0x3FF) * CHUNK_SIZE;
int plane = chunkData >> 24 & 0x3;
if (worldPoint.getX() >= templateChunkX && worldPoint.getX() < templateChunkX + CHUNK_SIZE
&& worldPoint.getY() >= templateChunkY && worldPoint.getY() < templateChunkY + CHUNK_SIZE
&& plane == worldPoint.getPlane())
{
WorldPoint p = new WorldPoint(client.getBaseX() + x * CHUNK_SIZE + (worldPoint.getX() & (CHUNK_SIZE - 1)),
client.getBaseY() + y * CHUNK_SIZE + (worldPoint.getY() & (CHUNK_SIZE - 1)),
z);
p = rotate(p, rotation);
worldPoints.add(p);
}
}
}
}