use of net.minecraft.client.multiplayer.ClientAdvancementManager in project takumicraft by TNTModders.
the class TakumiUtils method getAdvancementUnlocked.
@SideOnly(Side.CLIENT)
public static boolean getAdvancementUnlocked(ResourceLocation location) {
ClientAdvancementManager manager = Minecraft.getMinecraft().player.connection.getAdvancementManager();
try {
Field field = TakumiASMNameMap.getField(ClientAdvancementManager.class, "advancementToProgress");
field.setAccessible(true);
Map<Advancement, AdvancementProgress> advancementToProgress = (Map<Advancement, AdvancementProgress>) field.get(manager);
if (advancementToProgress.containsKey(manager.getAdvancementList().getAdvancement(location))) {
return advancementToProgress.get(manager.getAdvancementList().getAdvancement(location)).isDone();
}
} catch (NoSuchFieldException | IllegalAccessException e) {
e.printStackTrace();
}
return false;
}
Aggregations