@Override public void drawBackground(int mouseX, int mouseY, float gameTicks) { glEnable(GL_BLEND); ApplyColor(); super.drawBackground(mouseX, mouseY, gameTicks); drawIcon(stat.getIcon(level), posX + 3, posY + 3); if (direction != ForgeDirection.UNKNOWN) { glPushMatrix(); glTranslated(posX, posY, 0); glTranslated(sizeX / 2, sizeY / 2, 0); glTranslated(direction.offsetX * (sizeX * 0.75), -direction.offsetY * (sizeY * 0.75), 0); if (direction == ForgeDirection.EAST) { glRotated(90, 0, 0, 1); } else if (direction == ForgeDirection.WEST) { glRotated(-90, 0, 0, 1); } else if (direction == ForgeDirection.DOWN) { glRotated(180, 0, 0, 1); } glTranslated(-3.5, -3.5, 0); ClientProxy.holoIcons.renderIcon("up_arrow", 0, 0); glPopMatrix(); } if (stat.maxLevel() > 1 && level > 0) { getFontRenderer().drawString(Integer.toString(level), posX + 16, posY + 16, 0xFFFFFF); } ResetColor(); glDisable(GL_BLEND); }
@Override public boolean isEnabled() { if (stat.canBeUnlocked(player, level)) { if (player.getUnlockedLevel(stat) < stat.maxLevel()) { return true; } } return false; }
@Override public void onAction(int mouseX, int mouseY, int mouseButton) { if (super.intersectsWith(mouseX, mouseY)) { if (stat.canBeUnlocked(player, level + 1) && level < stat.maxLevel()) { gui.playSound(Reference.MOD_ID + ":" + "gui.biotic_stat_unlock", 1, 1); MatterOverdrive.packetPipeline.sendToServer( new PacketUnlockBioticStat(stat.getUnlocalizedName(), ++level)); } } super.onAction(mouseX, mouseY, mouseButton); }
public void manageBiostats(InputEvent.KeyInputEvent event) { AndroidPlayer androidPlayer = AndroidPlayer.get(FMLClientHandler.instance().getClientPlayerEntity()); for (IBionicStat stat : AndroidStatRegistry.stats.values()) { int level = androidPlayer.getUnlockedLevel(stat); if (level > 0 && stat.isEnabled(androidPlayer, level)) { stat.onKeyPress( androidPlayer, androidPlayer.getUnlockedLevel(stat), Keyboard.getEventKey(), Keyboard.getEventKeyState()); } } }
protected void ApplyColor() { if (stat.canBeUnlocked(player, level) || player.isUnlocked(stat, level)) { if (level <= 0) { RenderUtils.applyColorWithMultipy(Reference.COLOR_HOLO, 0.5f); } else { RenderUtils.applyColor(Reference.COLOR_HOLO); } } else { RenderUtils.applyColorWithMultipy(Reference.COLOR_HOLO_RED, 0.5f); } }
public ElementBioStat( MOGuiBase gui, int posX, int posY, IBionicStat stat, int level, AndroidPlayer player, ForgeDirection direction) { super(gui, gui, posX, posY, stat.getUnlocalizedName(), 0, 0, 0, 0, 22, 22, ""); texture = ElementSlot.getTexture("holo"); texW = 22; texH = 22; this.stat = stat; this.player = player; this.level = level; this.direction = direction; }
@Override public void addTooltip(List<String> list) { stat.onTooltip(player, level, list, gui.getMouseX(), gui.getMouseY()); }