Merge pull request #576 from Sethtroll/fixpohobjects

Fix Poh icons displaying when changing planes
This commit is contained in:
Adam
2018-02-14 12:23:21 -05:00
committed by GitHub
3 changed files with 19 additions and 16 deletions

View File

@@ -65,17 +65,20 @@ public class BurnerOverlay extends Overlay
return null;
}
for (GameObject object : plugin.getPohObjects())
plugin.getPohObjects().forEach((object, tile) ->
{
if (BURNER_UNLIT.contains(object.getId()))
if (tile.getPlane() == client.getPlane())
{
drawBurner(graphics, "Unlit", object, Color.RED, parent);
if (BURNER_UNLIT.contains(object.getId()))
{
drawBurner(graphics, "Unlit", object, Color.RED, parent);
}
else if (BURNER_LIT.contains(object.getId()))
{
drawBurner(graphics, "Lit", object, Color.GREEN, parent);
}
}
else if (BURNER_LIT.contains(object.getId()))
{
drawBurner(graphics, "Lit", object, Color.GREEN, parent);
}
}
});
return null;
}

View File

@@ -31,7 +31,6 @@ import java.util.List;
import javax.inject.Inject;
import lombok.Getter;
import net.runelite.api.Client;
import net.runelite.api.GameObject;
import net.runelite.api.Perspective;
import net.runelite.api.Point;
import static net.runelite.client.plugins.poh.PohIcons.ALTAR;
@@ -87,11 +86,10 @@ public class PohOverlay extends Overlay
}
Point localLocation = client.getLocalPlayer().getLocalLocation();
for (GameObject object : plugin.getPohObjects())
plugin.getPohObjects().forEach((object, tile) ->
{
Point location = object.getLocalLocation();
if (localLocation.distanceTo(location) <= MAX_DISTANCE)
if (tile.getPlane() == client.getPlane() && localLocation.distanceTo(location) <= MAX_DISTANCE)
{
PohIcons icon = PohIcons.getIcon(object.getId());
@@ -105,7 +103,7 @@ public class PohOverlay extends Overlay
}
}
}
}
});
return null;
}

View File

@@ -30,7 +30,8 @@ import com.google.inject.Binder;
import com.google.inject.Provides;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import javax.inject.Inject;
import lombok.AccessLevel;
@@ -43,6 +44,7 @@ import static net.runelite.api.ObjectID.INCENSE_BURNER_13210;
import static net.runelite.api.ObjectID.INCENSE_BURNER_13211;
import static net.runelite.api.ObjectID.INCENSE_BURNER_13212;
import static net.runelite.api.ObjectID.INCENSE_BURNER_13213;
import net.runelite.api.Tile;
import net.runelite.api.events.ConfigChanged;
import net.runelite.api.events.GameObjectDespawned;
import net.runelite.api.events.GameObjectSpawned;
@@ -61,7 +63,7 @@ public class PohPlugin extends Plugin
static final Set<Integer> BURNER_LIT = Sets.newHashSet(INCENSE_BURNER_13209, INCENSE_BURNER_13211, INCENSE_BURNER_13213);
@Getter(AccessLevel.PACKAGE)
private final Set<GameObject> pohObjects = new HashSet<>();
private final Map<GameObject, Tile> pohObjects = new HashMap<>();
@Inject
private PohOverlay overlay;
@@ -105,7 +107,7 @@ public class PohPlugin extends Plugin
GameObject gameObject = event.getGameObject();
if (BURNER_LIT.contains(gameObject.getId()) || BURNER_UNLIT.contains(gameObject.getId()) || PohIcons.getIcon(gameObject.getId()) != null)
{
pohObjects.add(gameObject);
pohObjects.put(gameObject, event.getTile());
}
}