use of net.minecraft.client.GameSettings in project WarDance by Jackiecrazy.
the class RenderEvents method displayCoolie.
@SubscribeEvent
public static void displayCoolie(RenderGameOverlayEvent.Post event) {
MainWindow sr = event.getWindow();
final Minecraft mc = Minecraft.getInstance();
final MatrixStack stack = event.getMatrixStack();
if (GeneralConfig.dual) {
if (event.getType().equals(RenderGameOverlayEvent.ElementType.CROSSHAIRS)) {
// draw offhand cooldown, crosshair type
{
GameSettings gamesettings = mc.options;
if (gamesettings.getCameraType() == PointOfView.FIRST_PERSON) {
int width = sr.getGuiScaledWidth();
int height = sr.getGuiScaledHeight();
ClientPlayerEntity player = mc.player;
if (player == null)
return;
if (!gamesettings.renderDebug || gamesettings.hideGui || player.isReducedDebugInfo() || gamesettings.reducedDebugInfo) {
if (mc.options.attackIndicator == AttackIndicatorStatus.CROSSHAIR) {
GlStateManager._enableAlphaTest();
float cooldown = CombatUtils.getCooledAttackStrength(player, Hand.OFF_HAND, 0f);
boolean hyperspeed = false;
if (getEntityLookedAt(player, GeneralUtils.getAttributeValueHandSensitive(player, ForgeMod.REACH_DISTANCE.get(), Hand.OFF_HAND)) != null && cooldown >= 1.0F) {
hyperspeed = CombatUtils.getCooldownPeriod(player, Hand.OFF_HAND) > 5.0F;
hyperspeed = hyperspeed & (getEntityLookedAt(player, GeneralUtils.getAttributeValueHandSensitive(player, ForgeMod.REACH_DISTANCE.get(), Hand.OFF_HAND))).isAlive();
}
int y = height / 2 - 7 - 7;
int x = width / 2 - 8;
if (hyperspeed) {
mc.gui.blit(stack, x, y, 68, 94, 16, 16);
} else if (cooldown < 1.0F) {
int k = (int) (cooldown * 17.0F);
mc.gui.blit(stack, x, y, 36, 94, 16, 4);
mc.gui.blit(stack, x, y, 52, 94, k, 4);
}
}
}
}
}
}
if (event.getType().equals(RenderGameOverlayEvent.ElementType.HOTBAR)) {
// draw offhand cooldown, hotbar type
if (mc.getCameraEntity() instanceof PlayerEntity) {
GlStateManager._clearColor(1.0F, 1.0F, 1.0F, 1.0F);
PlayerEntity p = (PlayerEntity) mc.getCameraEntity();
ItemStack itemstack = p.getOffhandItem();
HandSide oppositeHand = p.getMainArm().getOpposite();
int halfOfScreen = sr.getGuiScaledWidth() / 2;
GlStateManager._enableRescaleNormal();
RenderSystem.enableBlend();
RenderSystem.defaultBlendFunc();
RenderHelper.turnBackOn();
if (mc.options.attackIndicator == AttackIndicatorStatus.HOTBAR) {
float strength = CombatUtils.getCooledAttackStrength(p, Hand.OFF_HAND, 0);
if (strength < 1.0F) {
int y = sr.getGuiScaledHeight() - 20;
int x = halfOfScreen + 91 + 6;
if (oppositeHand == HandSide.LEFT) {
x = halfOfScreen - 91 - 22;
}
mc.getTextureManager().bind(AbstractGui.GUI_ICONS_LOCATION);
int modStrength = (int) (strength * 19.0F);
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.gui.blit(stack, x + 18, y, 0, 94, 18, 18);
mc.gui.blit(stack, x + 18, y + 18 - modStrength, 18, 112 - modStrength, 18, modStrength);
}
}
RenderHelper.turnOff();
RenderSystem.disableBlend();
}
}
}
if (event.getType().equals(RenderGameOverlayEvent.ElementType.ALL))
if (mc.getCameraEntity() instanceof PlayerEntity) {
ClientPlayerEntity player = mc.player;
ICombatCapability cap = CombatData.getCap(player);
int width = sr.getGuiScaledWidth();
int height = sr.getGuiScaledHeight();
mc.getTextureManager().bind(raihud);
currentSpiritLevel = updateValue(currentSpiritLevel, cap.getSpirit());
currentMightLevel = updateValue(currentMightLevel, cap.getMight());
currentComboLevel = cap.getRank() > currentComboLevel ? updateValue(currentComboLevel, cap.getRank()) : cap.getRank();
// yourCurrentPostureLevel = updateValue(yourCurrentPostureLevel, cap.getPosture());
if (cap.isCombatMode()) {
stack.pushPose();
RenderSystem.enableBlend();
RenderSystem.enableAlphaTest();
Pair<Integer, Integer> pair = translateCoords(ClientConfig.CONFIG.might, width, height);
int x = Math.max(pair.getFirst() - 16, 0);
int y = Math.min(pair.getSecond() - 16, height - 32);
int fillHeight = (int) (Math.min(1, currentMightLevel / cap.getMaxMight()) * 32);
if (ClientConfig.CONFIG.might.enabled) {
// might circle
RenderSystem.color4f(1, 1, 1, 1);
stack.pushPose();
stack.pushPose();
mc.gui.blit(stack, x, y, 0, 64, 32, 32);
stack.popPose();
// might circle filling
stack.pushPose();
mc.gui.blit(stack, x, y + 32 - fillHeight, 0, 96 - fillHeight, 32, fillHeight);
stack.popPose();
fillHeight += Math.min(fillHeight, 3);
fillHeight = Math.min(fillHeight, 32);
// might base
stack.pushPose();
mc.gui.blit(stack, x, y, 32, 64, 32, 32);
stack.popPose();
// might illumination
stack.pushPose();
mc.gui.blit(stack, x, y + 32 - fillHeight, 64, 96 - fillHeight, 32, fillHeight);
stack.popPose();
stack.popPose();
}
pair = translateCoords(ClientConfig.CONFIG.spirit, width, height);
x = MathHelper.clamp(pair.getFirst() - 16, 0, width - 32);
y = MathHelper.clamp(pair.getSecond() - 16, 0, height - 32);
fillHeight = (int) (Math.min(1, currentSpiritLevel / cap.getMaxSpirit()) * 32);
String display = formatter.format(currentSpiritLevel) + "/" + formatter.format(cap.getMaxSpirit());
// spirit circle
stack.pushPose();
if (ClientConfig.CONFIG.spirit.enabled) {
stack.pushPose();
mc.gui.blit(stack, x, y, 0, 96, 32, 32);
stack.popPose();
// spirit circle filling
stack.pushPose();
mc.gui.blit(stack, x, y + 32 - fillHeight, 0, 128 - fillHeight, 32, fillHeight);
stack.popPose();
fillHeight += Math.min(fillHeight, 3);
fillHeight = Math.min(fillHeight, 32);
// spirit base
stack.pushPose();
mc.gui.blit(stack, x, y + 1, 32, 96, 32, 32);
stack.popPose();
// spirit illumination
stack.pushPose();
mc.gui.blit(stack, x, y + 33 - fillHeight, 64, 128 - fillHeight, 32, fillHeight);
stack.popPose();
}
if (ClientConfig.CONFIG.spiritNumber.enabled) {
pair = translateCoords(ClientConfig.CONFIG.spiritNumber, width, height);
mc.font.drawShadow(event.getMatrixStack(), display, pair.getFirst() - mc.font.width(display) / 2f, pair.getSecond() - 2, ClientConfig.spiritColor);
}
if (ClientConfig.CONFIG.mightNumber.enabled) {
pair = translateCoords(ClientConfig.CONFIG.mightNumber, width, height);
display = formatter.format(currentMightLevel) + "/" + formatter.format(cap.getMaxMight());
mc.font.drawShadow(event.getMatrixStack(), display, pair.getFirst() - mc.font.width(display) / 2f, pair.getSecond() - 2, ClientConfig.mightColor);
}
stack.popPose();
RenderSystem.disableAlphaTest();
RenderSystem.disableBlend();
stack.popPose();
// combo bar at 224,20 to 229, 121. Grace at 222,95 to 224, 121
// initial bar
RenderSystem.enableBlend();
stack.pushPose();
if (ClientConfig.CONFIG.combo.enabled) {
mc.getTextureManager().bind(raihud);
int combowidth = 32;
float workingCombo = currentComboLevel;
int comboU = (int) (MathHelper.clamp(Math.floor(workingCombo), 0, 4)) * 32;
int divisor = 1;
if (// S
workingCombo >= 4)
divisor = 2;
if (workingCombo >= 6) {
// SS
combowidth = 33;
comboU = 159;
divisor = 3;
}
if (workingCombo >= 9) {
// SSS
combowidth = 64;
comboU = 192;
fillHeight = (int) ((workingCombo - 9) * 32f);
} else if (divisor > 1)
fillHeight = (int) ((workingCombo - divisor * 2) / divisor * 32f);
else
fillHeight = (int) ((workingCombo - Math.floor(workingCombo)) * 32f);
pair = translateCoords(ClientConfig.CONFIG.combo, width, height);
x = MathHelper.clamp(pair.getFirst() - combowidth / 2, 0, width - combowidth);
y = MathHelper.clamp(pair.getSecond() - 23, 0, height - 46);
mc.gui.blit(stack, x, y, comboU, 0, combowidth, 32);
// fancy fill percentage
mc.gui.blit(stack, x, y + 33 - fillHeight, comboU, 65 - fillHeight, combowidth, fillHeight - 2);
}
stack.popPose();
RenderSystem.disableBlend();
}
mc.getTextureManager().bind(amo);
// render posture bar if not full, displayed even out of combat mode because it's pretty relevant to not dying
if (cap.isCombatMode() || cap.getPosture() < cap.getMaxPosture() || cap.getStaggerTime() > 0 || cap.getShatterCooldown() < Math.floor(GeneralUtils.getAttributeValueSafe(player, WarAttributes.SHATTER.get())) || cap.getBarrier() < cap.getMaxBarrier())
drawPostureBarAt(true, stack, player, width, height);
Entity look = getEntityLookedAt(player, 32);
if (look instanceof LivingEntity) {
LivingEntity looked = (LivingEntity) look;
List<Skill> afflict = new ArrayList<>();
final ISkillCapability skill = CasterData.getCap(player);
if (ClientConfig.CONFIG.enemyAfflict.enabled) {
// coup de grace
final Skill variant = skill.getEquippedVariation(SkillCategories.coup_de_grace);
if (look != player && skill.isSkillUsable(variant)) {
CoupDeGrace cdg = (CoupDeGrace) variant;
if (cdg.willKillOnCast(player, looked)) {
afflict.add(cdg);
}
}
// marks
afflict.addAll(Marks.getCap(looked).getActiveMarks().keySet());
Pair<Integer, Integer> pair = translateCoords(ClientConfig.CONFIG.enemyAfflict, width, height);
for (int index = 0; index < afflict.size(); index++) {
Skill s = afflict.get(index);
mc.getTextureManager().bind(s.icon());
Color c = s.getColor();
RenderSystem.color4f(c.getRed() / 255f, c.getGreen() / 255f, c.getBlue() / 255f, 1);
AbstractGui.blit(stack, pair.getFirst() - (afflict.size() - 1 - index) * 16 + (afflict.size() - 1) * 8 - 8, pair.getSecond(), 0, 0, 16, 16, 16, 16);
}
}
stealth: if (ClientConfig.CONFIG.stealth.enabled && cap.isCombatMode()) {
Pair<Integer, Integer> pair = translateCoords(ClientConfig.CONFIG.stealth, width, height);
final Tuple<StealthUtils.Awareness, Double> info = stealthInfo(looked);
double dist = info.getB();
int shift = 0;
switch(info.getA()) {
case ALERT:
break stealth;
case DISTRACTED:
shift = 1;
break;
case UNAWARE:
shift = looked.distanceToSqr(player) < dist * dist ? 2 : 3;
break;
}
renderEye(looked, event.getPartialTicks(), stack);
mc.getTextureManager().bind(stealth);
AbstractGui.blit(stack, pair.getFirst() - 16, pair.getSecond() - 8, 0, shift * 16, 32, 16, 64, 64);
}
RenderSystem.color4f(1, 1, 1, 1);
if (ClientConfig.CONFIG.enemyPosture.enabled && (cap.isCombatMode() || CombatData.getCap((LivingEntity) look).getPosture() < CombatData.getCap((LivingEntity) look).getMaxPosture() || CombatData.getCap((LivingEntity) look).getStaggerTime() > 0 || cap.getShatterCooldown() < GeneralUtils.getAttributeValueSafe(player, WarAttributes.SHATTER.get()) || cap.getBarrier() < cap.getMaxBarrier()))
// Math.min(HudConfig.client.enemyPosture.x, width - 64), Math.min(HudConfig.client.enemyPosture.y, height - 64));
drawPostureBarAt(false, stack, looked, width, height);
}
}
}
use of net.minecraft.client.GameSettings in project ModernUI by BloCamLimb.
the class SettingLanguage method applyLanguage.
private void applyLanguage() {
LanguageManager manager = minecraft.getLanguageManager();
GameSettings gameSettings = minecraft.gameSettings;
if (highlight != null && !highlight.getLanguage().getCode().equals(manager.getCurrentLanguage().getCode())) {
manager.setCurrentLanguage(highlight.getLanguage());
gameSettings.language = highlight.getLanguage().getCode();
ForgeHooksClient.refreshResources(minecraft, VanillaResourceType.LANGUAGES);
// FIXME
// minecraft.fontRenderer.getBidiFlag(manager.isCurrentLanguageBidirectional());
gameSettings.saveOptions();
}
}
use of net.minecraft.client.GameSettings in project ModernUI by BloCamLimb.
the class SettingResourcePack method applyResourcePacks.
private void applyResourcePacks() {
List<ResourcePackInfo> list = Lists.newArrayList();
GameSettings gameSettings = minecraft.gameSettings;
for (ResourcePackEntry c2 : selectedGroup.getEntries()) {
list.add(c2.getResourcePack());
}
Collections.reverse(list);
// FIXME
// minecraft.getResourcePackList().setEnabledPacks(list);
gameSettings.resourcePacks.clear();
gameSettings.incompatibleResourcePacks.clear();
for (ResourcePackInfo c3 : list) {
if (!c3.isOrderLocked()) {
gameSettings.resourcePacks.add(c3.getName());
if (!c3.getCompatibility().isCompatible()) {
gameSettings.incompatibleResourcePacks.add(c3.getName());
}
}
}
gameSettings.saveOptions();
minecraft.reloadResources();
applyButton.setStatus(WidgetStatus.INACTIVE, false);
}
use of net.minecraft.client.GameSettings in project ModernUI by BloCamLimb.
the class KeyBindingEntry method menuActions.
/**
* Context menu
*/
private void menuActions(int index) {
if (index == 0) {
GameSettings gameSettings = Minecraft.getInstance().gameSettings;
keyBinding.setToDefault();
gameSettings.setKeyBindingCode(keyBinding, keyBinding.getDefault());
updateKeyText();
conflictsCallback.run();
}
}
use of net.minecraft.client.GameSettings in project ModernUI by BloCamLimb.
the class SettingGeneral method addSkinCategory.
private void addSkinCategory(List<SettingCategoryGroup> groups) {
List<SettingEntry> list = new ArrayList<>();
GameSettings gameSettings = minecraft.gameSettings;
list.add(SettingsManager.MAIN_HAND.apply(window));
for (PlayerModelPart part : PlayerModelPart.values()) {
BooleanSettingEntry entry = new BooleanSettingEntry(window, part.getName().getString(), gameSettings.getModelParts().contains(part), b -> gameSettings.setModelPartEnabled(part, b));
list.add(entry);
}
SettingCategoryGroup categoryGroup = new SettingCategoryGroup(window, I18n.format("gui.modernui.settings.category.skin"), list);
groups.add(categoryGroup);
}
Aggregations