make some decent mixins
This commit is contained in:
@@ -1608,62 +1608,6 @@ public interface Client extends GameEngine
|
||||
*/
|
||||
void setNPCsHidden(boolean state);
|
||||
|
||||
/**
|
||||
* Increments the counter for how many times this npc has been selected to be hidden
|
||||
*
|
||||
* @param name npc name
|
||||
*/
|
||||
void addHiddenNpcName(String name);
|
||||
|
||||
/**
|
||||
* Decrements the counter for how many times this npc has been selected to be hidden
|
||||
*
|
||||
* @param name npc name
|
||||
*/
|
||||
void removeHiddenNpcName(String name);
|
||||
|
||||
/**
|
||||
* Forcibly unhides an npc by setting its counter to zero
|
||||
*
|
||||
* @param name npc name
|
||||
*/
|
||||
void forciblyUnhideNpcName(String name);
|
||||
|
||||
/**
|
||||
* Get the list of NPC indices that are currently hidden
|
||||
*
|
||||
* @return all of the current hidden NPC Indices
|
||||
*/
|
||||
List<Integer> getHiddenNpcIndices();
|
||||
|
||||
/**
|
||||
* If an NPC index is in this List then do not render it
|
||||
*
|
||||
* @param npcIndices the npc indices to hide
|
||||
*/
|
||||
void setHiddenNpcIndices(List<Integer> npcIndices);
|
||||
|
||||
/**
|
||||
* Increments the counter for how many times this npc has been selected to be hidden on death
|
||||
*
|
||||
* @param name npc name
|
||||
*/
|
||||
void addHiddenNpcDeath(String name);
|
||||
|
||||
/**
|
||||
* Decrements the counter for how many times this npc has been selected to be hidden on death
|
||||
*
|
||||
* @param name npc name
|
||||
*/
|
||||
void removeHiddenNpcDeath(String name);
|
||||
|
||||
/**
|
||||
* Forcibly unhides a hidden-while-dead npc by setting its counter to zero
|
||||
*
|
||||
* @param name npc name
|
||||
*/
|
||||
void forciblyUnhideNpcDeath(String name);
|
||||
|
||||
/**
|
||||
* Sets whether 2D sprites (ie. overhead prayers) related to
|
||||
* the NPCs are hidden.
|
||||
|
||||
@@ -83,6 +83,7 @@ dependencies {
|
||||
implementation(project(":http-api"))
|
||||
implementation(group = "net.runelite.gluegen", name = "gluegen-rt", version = "2.4.0-rc-20200429")
|
||||
implementation(group = "net.runelite.jogl", name = "jogl-all", version = "2.4.0-rc-20200429")
|
||||
implementation(group = "net.runelite.jocl", name = "jocl", version = "1.0")
|
||||
|
||||
runtimeOnly(group = "org.pushing-pixels", name = "radiance-trident", version = "2.5.1")
|
||||
runtimeOnly(project(":runescape-api"))
|
||||
@@ -94,6 +95,8 @@ dependencies {
|
||||
runtimeOnly(group = "net.runelite.jogl", name = "jogl-all", version = "2.4.0-rc-20200429", classifier = "natives-windows-amd64")
|
||||
runtimeOnly(group = "net.runelite.jogl", name = "jogl-all", version = "2.4.0-rc-20200429", classifier = "natives-windows-i586")
|
||||
runtimeOnly(group = "net.runelite.jogl", name = "jogl-all", version = "2.4.0-rc-20200429", classifier = "natives-macosx-universal")
|
||||
runtimeOnly(group = "net.runelite.jocl", name = "jocl", version = "1.0", classifier = "macos-x64")
|
||||
runtimeOnly(group = "net.runelite.jocl", name = "jocl", version = "1.0", classifier = "macos-arm64")
|
||||
|
||||
testAnnotationProcessor(group = "org.projectlombok", name = "lombok", version = "1.18.16")
|
||||
|
||||
|
||||
@@ -41,10 +41,10 @@ public abstract class EntityHiderBridgeMixin implements RSClient
|
||||
public static boolean isHidingEntities;
|
||||
|
||||
@Inject
|
||||
public static boolean hidePlayers;
|
||||
public static boolean hideOthers;
|
||||
|
||||
@Inject
|
||||
public static boolean hidePlayers2D;
|
||||
public static boolean hideOthers2D;
|
||||
|
||||
@Inject
|
||||
public static boolean hideFriends;
|
||||
@@ -52,6 +52,9 @@ public abstract class EntityHiderBridgeMixin implements RSClient
|
||||
@Inject
|
||||
public static boolean hideClanMates;
|
||||
|
||||
@Inject
|
||||
public static boolean hideIgnores;
|
||||
|
||||
@Inject
|
||||
public static boolean hideLocalPlayer;
|
||||
|
||||
@@ -76,21 +79,9 @@ public abstract class EntityHiderBridgeMixin implements RSClient
|
||||
@Inject
|
||||
public static boolean hideDeadNPCs;
|
||||
|
||||
@Inject
|
||||
public static HashMap<String, Integer> hiddenNpcsName = new HashMap<>();
|
||||
|
||||
@Inject
|
||||
public static HashMap<String, Integer> hiddenNpcsDeath = new HashMap<>();
|
||||
|
||||
@Inject
|
||||
public static List<String> hideSpecificPlayers = new ArrayList<>();
|
||||
|
||||
@Inject
|
||||
public static Set<Integer> blacklistDeadNpcs = new HashSet<>();
|
||||
|
||||
@Inject
|
||||
public static List<Integer> hiddenNpcIndices = new ArrayList<>();
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public void setIsHidingEntities(boolean state)
|
||||
@@ -100,16 +91,16 @@ public abstract class EntityHiderBridgeMixin implements RSClient
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public void setPlayersHidden(boolean state)
|
||||
public void setOthersHidden(boolean state)
|
||||
{
|
||||
hidePlayers = state;
|
||||
hideOthers = state;
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public void setPlayersHidden2D(boolean state)
|
||||
public void setOthersHidden2D(boolean state)
|
||||
{
|
||||
hidePlayers2D = state;
|
||||
hideOthers2D = state;
|
||||
}
|
||||
|
||||
@Inject
|
||||
@@ -126,6 +117,13 @@ public abstract class EntityHiderBridgeMixin implements RSClient
|
||||
hideClanMates = state;
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public void setIgnoresHidden(boolean state)
|
||||
{
|
||||
hideIgnores = state;
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public void setLocalPlayerHidden(boolean state)
|
||||
@@ -154,78 +152,6 @@ public abstract class EntityHiderBridgeMixin implements RSClient
|
||||
hideNPCs2D = state;
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public void addHiddenNpcName(String npc)
|
||||
{
|
||||
npc = npc.toLowerCase();
|
||||
int i = hiddenNpcsName.getOrDefault(npc, 0);
|
||||
if (i == Integer.MAX_VALUE)
|
||||
{
|
||||
throw new RuntimeException("NPC name " + npc + " has been hidden Integer.MAX_VALUE times, is something wrong?");
|
||||
}
|
||||
|
||||
hiddenNpcsName.put(npc, ++i);
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public void removeHiddenNpcName(String npc)
|
||||
{
|
||||
npc = npc.toLowerCase();
|
||||
int i = hiddenNpcsName.getOrDefault(npc, 0);
|
||||
if (i == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
hiddenNpcsName.put(npc, --i);
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public void forciblyUnhideNpcName(String npc)
|
||||
{
|
||||
npc = npc.toLowerCase();
|
||||
hiddenNpcsName.put(npc, 0);
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public void addHiddenNpcDeath(String npc)
|
||||
{
|
||||
npc = npc.toLowerCase();
|
||||
int i = hiddenNpcsDeath.getOrDefault(npc, 0);
|
||||
if (i == Integer.MAX_VALUE)
|
||||
{
|
||||
throw new RuntimeException("NPC death " + npc + " has been hidden Integer.MAX_VALUE times, is something wrong?");
|
||||
}
|
||||
|
||||
hiddenNpcsDeath.put(npc, ++i);
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public void removeHiddenNpcDeath(String npc)
|
||||
{
|
||||
npc = npc.toLowerCase();
|
||||
int i = hiddenNpcsDeath.getOrDefault(npc, 0);
|
||||
if (i == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
hiddenNpcsDeath.put(npc, --i);
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public void forciblyUnhideNpcDeath(String npc)
|
||||
{
|
||||
npc = npc.toLowerCase();
|
||||
hiddenNpcsDeath.put(npc, 0);
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public void setHideSpecificPlayers(List<String> players)
|
||||
@@ -233,13 +159,6 @@ public abstract class EntityHiderBridgeMixin implements RSClient
|
||||
hideSpecificPlayers = players;
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public void setBlacklistDeadNpcs(Set<Integer> blacklist)
|
||||
{
|
||||
blacklistDeadNpcs = blacklist;
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public void setPetsHidden(boolean state)
|
||||
@@ -267,18 +186,4 @@ public abstract class EntityHiderBridgeMixin implements RSClient
|
||||
{
|
||||
hideDeadNPCs = state;
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public void setHiddenNpcIndices(List<Integer> npcIndices)
|
||||
{
|
||||
hiddenNpcIndices = npcIndices;
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public List<Integer> getHiddenNpcIndices()
|
||||
{
|
||||
return hiddenNpcIndices;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,10 +36,10 @@ import net.runelite.api.mixins.Shadow;
|
||||
import net.runelite.api.util.Text;
|
||||
import net.runelite.rs.api.RSActor;
|
||||
import net.runelite.rs.api.RSClient;
|
||||
import net.runelite.rs.api.RSRenderable;
|
||||
import net.runelite.rs.api.RSNPC;
|
||||
import net.runelite.rs.api.RSPlayer;
|
||||
import net.runelite.rs.api.RSProjectile;
|
||||
import net.runelite.rs.api.RSRenderable;
|
||||
import net.runelite.rs.api.RSScene;
|
||||
|
||||
@Mixin(RSScene.class)
|
||||
@@ -51,11 +51,11 @@ public abstract class EntityHiderMixin implements RSScene
|
||||
@Shadow("isHidingEntities")
|
||||
private static boolean isHidingEntities;
|
||||
|
||||
@Shadow("hidePlayers")
|
||||
private static boolean hidePlayers;
|
||||
@Shadow("hideOthers")
|
||||
private static boolean hideOthers;
|
||||
|
||||
@Shadow("hidePlayers2D")
|
||||
private static boolean hidePlayers2D;
|
||||
@Shadow("hideOthers2D")
|
||||
private static boolean hideOthers2D;
|
||||
|
||||
@Shadow("hideFriends")
|
||||
private static boolean hideFriends;
|
||||
@@ -69,21 +69,15 @@ public abstract class EntityHiderMixin implements RSScene
|
||||
@Shadow("hideLocalPlayer2D")
|
||||
private static boolean hideLocalPlayer2D;
|
||||
|
||||
@Shadow("hideIgnores")
|
||||
private static boolean hideIgnores;
|
||||
|
||||
@Shadow("hideNPCs")
|
||||
private static boolean hideNPCs;
|
||||
|
||||
@Shadow("hiddenNpcsName")
|
||||
private static HashMap<String, Integer> hiddenNpcsName;
|
||||
|
||||
@Shadow("hiddenNpcsDeath")
|
||||
private static HashMap<String, Integer> hiddenNpcsDeath;
|
||||
|
||||
@Shadow("hideSpecificPlayers")
|
||||
private static List<String> hideSpecificPlayers;
|
||||
|
||||
@Shadow("blacklistDeadNpcs")
|
||||
private static Set<Integer> blacklistDeadNpcs;
|
||||
|
||||
@Shadow("hideNPCs2D")
|
||||
private static boolean hideNPCs2D;
|
||||
|
||||
@@ -99,9 +93,6 @@ public abstract class EntityHiderMixin implements RSScene
|
||||
@Shadow("hideDeadNPCs")
|
||||
private static boolean hideDeadNPCs;
|
||||
|
||||
@Shadow("hiddenNpcIndices")
|
||||
private static List<Integer> hiddenNpcIndices;
|
||||
|
||||
@Copy("newGameObject")
|
||||
@Replace("newGameObject")
|
||||
boolean copy$addEntityMarker(int var1, int var2, int var3, int var4, int var5, int x, int y, int var8, RSRenderable entity, int var10, boolean var11, long var12, int var13)
|
||||
@@ -143,10 +134,17 @@ public abstract class EntityHiderMixin implements RSScene
|
||||
|
||||
if (entity instanceof RSPlayer)
|
||||
{
|
||||
boolean local = drawingUI ? hideLocalPlayer2D : hideLocalPlayer;
|
||||
boolean other = drawingUI ? hidePlayers2D : hidePlayers;
|
||||
boolean isLocalPlayer = entity == client.getLocalPlayer();
|
||||
RSPlayer player = (RSPlayer) entity;
|
||||
RSPlayer local = client.getLocalPlayer();
|
||||
if (player.getName() == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (player == local)
|
||||
{
|
||||
return drawingUI ? !hideLocalPlayer2D : !hideLocalPlayer;
|
||||
}
|
||||
|
||||
for (String name : hideSpecificPlayers)
|
||||
{
|
||||
@@ -159,71 +157,47 @@ public abstract class EntityHiderMixin implements RSScene
|
||||
}
|
||||
}
|
||||
|
||||
if (isLocalPlayer ? local : other)
|
||||
if (hideAttackers && player.getInteracting() == local)
|
||||
{
|
||||
if (!hideAttackers)
|
||||
{
|
||||
if (player.getInteracting() == client.getLocalPlayer())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (player.getName() == null)
|
||||
{
|
||||
// player.isFriend() and player.isClanMember() npe when the player has a null name
|
||||
return false;
|
||||
}
|
||||
|
||||
return (!hideFriends && player.isFriend()) ||
|
||||
(!isLocalPlayer && !hideClanMates && player.isFriendsChatMember());
|
||||
if (player.isFriend())
|
||||
{
|
||||
return !hideFriends;
|
||||
}
|
||||
|
||||
if (player.isFriendsChatMember())
|
||||
{
|
||||
return !hideClanMates;
|
||||
}
|
||||
|
||||
if (client.getFriendManager().isIgnored(player.getRsName()))
|
||||
{
|
||||
return !hideIgnores;
|
||||
}
|
||||
|
||||
return drawingUI ? !hideOthers2D : !hideOthers;
|
||||
}
|
||||
else if (entity instanceof RSNPC)
|
||||
{
|
||||
RSNPC npc = (RSNPC) entity;
|
||||
|
||||
if (!hideAttackers)
|
||||
{
|
||||
if (npc.getInteracting() == client.getLocalPlayer())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (hidePets)
|
||||
{
|
||||
if (npc.getComposition().isFollower())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (hideDeadNPCs && npc.getHealthRatio() == 0 && !blacklistDeadNpcs.contains(npc.getId()))
|
||||
if (npc.isDead() && hideDeadNPCs)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (npc.getName() != null &&
|
||||
hiddenNpcsName.getOrDefault(Text.standardize(npc.getName().toLowerCase()), 0) > 0)
|
||||
if (npc.getComposition().isFollower() && npc.getIndex() != client.getFollowerIndex() && hidePets)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (npc.getName() != null && npc.getHealthRatio() == 0 &&
|
||||
hiddenNpcsDeath.getOrDefault(Text.standardize(npc.getName().toLowerCase()), 0) > 0)
|
||||
if (npc.getInteracting() == client.getLocalPlayer() && hideAttackers)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (Integer index : hiddenNpcIndices)
|
||||
{
|
||||
if (index != null && npc.getIndex() == index)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return drawingUI ? !hideNPCs2D : !hideNPCs;
|
||||
}
|
||||
else if (entity instanceof RSProjectile)
|
||||
|
||||
@@ -13,6 +13,9 @@ public interface RSFriendSystem
|
||||
@Import("isFriended")
|
||||
boolean isFriended(RSUsername var1, boolean var2);
|
||||
|
||||
@Import("isIgnored")
|
||||
boolean isIgnored(RSUsername var1);
|
||||
|
||||
@Import("addFriend")
|
||||
void addFriend(String username);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user