Skip to content

Commit

Permalink
made code less ugly
Browse files Browse the repository at this point in the history
  • Loading branch information
Paneedah committed Mar 13, 2023
1 parent 45ba2d3 commit 1c38ef4
Showing 1 changed file with 6 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -420,29 +420,20 @@ public void onAction(Button id) {

public static void forceSkin(String type) {
Method f = ReflectionHelper.findMethod(AbstractClientPlayer.class, "getPlayerInfo", "getPlayerInfo", null);

NetworkPlayerInfo npi = null;
try {
npi = (NetworkPlayerInfo) f.invoke((AbstractClientPlayer) mc.player, null);
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InvocationTargetException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try { npi = (NetworkPlayerInfo) f.invoke((AbstractClientPlayer) mc.player, null); }
catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { e.printStackTrace(); }

if(npi != null) {
try {
Field f2 = ReflectionHelper.findField(NetworkPlayerInfo.class, "skinType");
f2.setAccessible(true);
f2.set(npi, type);

} catch(Exception e) {

}
} catch(Exception ignored) {}
}

CompatibleWeaponRenderer.acp = null;
}

Expand Down

0 comments on commit 1c38ef4

Please sign in to comment.