use of blusunrize.lib.manual.gui.GuiButtonManual in project ImmersiveEngineering by BluSunrize.
the class ManualPageShader method initPage.
@Override
public void initPage(GuiManual gui, int x, int y, List<GuiButton> pageButtons) {
EntityPlayer player = ManualUtils.mc().thePlayer;
String username = player.getName();
unlocked = ShaderRegistry.receivedShaders.get(username).contains(shader.getName());
shaderItem = new ItemStack(ShaderRegistry.itemShader);
shaderItem.setTagCompound(new NBTTagCompound());
shaderItem.getTagCompound().setString("shader_name", shader.getName());
replicationCost = shader.replicationCost;
if (unlocked) {
ArrayList<ItemStack> list = new ArrayList<ItemStack>();
for (ItemStack is : ShaderRegistry.itemExamples) if (is != null && is.hasCapability(CapabilityShader.SHADER_CAPABILITY, null)) {
ItemStack s = is.copy();
ShaderWrapper wrapper = s.getCapability(CapabilityShader.SHADER_CAPABILITY, null);
if (wrapper != null) {
wrapper.setShaderItem(shaderItem);
list.add(s);
}
}
exampleItems = list.toArray(new ItemStack[list.size()]);
example = 0;
if (exampleItems.length > 1) {
pageButtons.add(new GuiButtonManualNavigation(gui, 100, x + 50, y, 10, 16, 0));
pageButtons.add(new GuiButtonManualNavigation(gui, 101, x + 100, y, 10, 16, 1));
}
} else
exampleItems = null;
this.text = "§lRarity: §r" + " " + shader.rarity.rarityName;
if (unlocked) {
String set = shader.info_set == null || shader.info_set.isEmpty() ? null : ManualUtils.attemptStringTranslation(Lib.DESC_INFO + "shader.set.%s", shader.info_set);
String reference = shader.info_reference == null || shader.info_reference.isEmpty() ? null : ManualUtils.attemptStringTranslation(Lib.DESC_INFO + "shader.reference.%s", shader.info_reference);
String details = shader.info_details == null || shader.info_details.isEmpty() ? null : ManualUtils.attemptStringTranslation(Lib.DESC_INFO + "shader.details.%s", shader.info_details);
if (set != null)
this.text += "<br><br>" + I18n.format("desc.immersiveengineering.info.shader.set") + " " + set;
if (reference != null)
this.text += "<br><br>" + I18n.format("desc.immersiveengineering.info.shader.reference") + "<br>" + reference;
if (details != null)
this.text += "<br><br>" + I18n.format("desc.immersiveengineering.info.shader.details") + "<br>" + details;
String cost = Integer.toString(replicationCost.inputSize);
if (!ApiUtils.hasPlayerIngredient(gui.mc.thePlayer, replicationCost) && !gui.mc.thePlayer.capabilities.isCreativeMode)
cost = TextFormatting.RED + cost;
pageButtons.add(new GuiButtonManual(gui, 102, x + 50, y + 138, 70, 12, TextFormatting.BOLD + I18n.format("ie.manual.entry.shaderList.order") + " " + cost + "x ").setTextColour(gui.getManual().getTextColour(), gui.getManual().getHighlightColour()));
} else {
this.text += "<br><br>" + I18n.format("ie.manual.entry.shaderList.noInfo");
if (player.capabilities.isCreativeMode)
pageButtons.add(new GuiButtonManual(gui, 103, x + 10, y + 80, 100, 16, I18n.format("ie.manual.entry.shaderList.unlock")).setTextColour(gui.getManual().getTextColour(), gui.getManual().getHighlightColour()));
}
super.initPage(gui, x, y, pageButtons);
}
Aggregations