Search in sources :

Example 6 with ClientConfiguration

use of com.almuradev.almura.core.client.config.ClientConfiguration in project Almura by AlmuraDev.

the class MixinTileEntityChestRenderer method onRender.

@Inject(method = "render", at = @At("HEAD"), cancellable = true)
private void onRender(TileEntityChest te, double x, double y, double z, float partialTicks, int destroyStage, float val, CallbackInfo ci) {
    // 0 means perform Minecraft logic only, we do not interfere
    final ClientConfiguration configuration = ClientStaticAccess.configAdapter.get();
    if (configuration.general.chestRenderDistance == 0) {
        return;
    }
    EntityLivingBase viewer = (EntityLivingBase) Minecraft.getMinecraft().getRenderViewEntity();
    if (viewer == null) {
        viewer = Minecraft.getMinecraft().player;
    }
    if (viewer != null && te.getDistanceSq(viewer.posX, viewer.posY, viewer.posZ) > (configuration.general.chestRenderDistance * 16) && te.hasWorld()) {
        ci.cancel();
    }
}
Also used : EntityLivingBase(net.minecraft.entity.EntityLivingBase) ClientConfiguration(com.almuradev.almura.core.client.config.ClientConfiguration) Inject(org.spongepowered.asm.mixin.injection.Inject)

Example 7 with ClientConfiguration

use of com.almuradev.almura.core.client.config.ClientConfiguration in project Almura by AlmuraDev.

the class SimpleOptionsMenu method onButtonClick.

@Subscribe
public void onButtonClick(UIButton.ClickEvent event) {
    switch(event.getComponent().getName()) {
        case "button.optimized":
            AlmuraSettings.optimizeGame();
            this.close();
            break;
        case "button.hudType":
            final ClientConfiguration configuration = configAdapter.get();
            // Check if the current HUD is the Origin HUD
            boolean isOrigin = configuration.general.hud.equalsIgnoreCase(HUDType.ORIGIN);
            configuration.general.hud = isOrigin ? HUDType.VANILLA : HUDType.ORIGIN;
            // Flip the boolean since we're now on the vanilla HUD
            isOrigin = !isOrigin;
            this.buttonHudType.setText("HUD: " + (isOrigin ? "Origin" : "Vanilla"));
            this.sliderOriginHudOpacity.setAlpha(isOrigin ? 255 : 128);
            this.sliderOriginHudOpacity.setEnabled(isOrigin);
            if (isOrigin) {
                this.sliderOriginHudOpacity.setTooltip((UITooltip) null);
            } else {
                this.sliderOriginHudOpacity.setTooltip("Only available when Origin HUD is in use.");
            }
            break;
        case "button.done":
            this.close();
            break;
    }
    saveAndLoad();
}
Also used : ClientConfiguration(com.almuradev.almura.core.client.config.ClientConfiguration) Subscribe(com.google.common.eventbus.Subscribe)

Example 8 with ClientConfiguration

use of com.almuradev.almura.core.client.config.ClientConfiguration in project Almura by AlmuraDev.

the class SimpleOptionsMenu method onValueChange.

@Subscribe
public void onValueChange(ComponentEvent.ValueChange event) {
    final ClientConfiguration configuration = configAdapter.get();
    switch(event.getComponent().getName()) {
        case "slider.originHudOpacity":
            configuration.general.originHudOpacity = (int) event.getNewValue();
            break;
        case "slider.chestRenderDistance":
            configuration.general.chestRenderDistance = ((OptionsConverter.Options) event.getNewValue()).value;
            break;
        case "slider.signTextRenderDistance":
            configuration.general.signTextRenderDistance = ((OptionsConverter.Options) event.getNewValue()).value;
            break;
        case "slider.itemFrameRenderDistance":
            configuration.general.itemFrameRenderDistance = ((OptionsConverter.Options) event.getNewValue()).value;
            break;
        case "slider.playerNameRenderDistance":
            configuration.general.playerNameRenderDistance = ((OptionsConverter.Options) event.getNewValue()).value;
            break;
        case "slider.enemyNameRenderDistance":
            configuration.general.enemyNameRenderDistance = ((OptionsConverter.Options) event.getNewValue()).value;
            break;
        case "slider.animalNameRenderDistance":
            configuration.general.animalNameRenderDistance = ((OptionsConverter.Options) event.getNewValue()).value;
            break;
        case "checkbox.world_compass_widget":
            configuration.general.displayWorldCompassWidget = (boolean) event.getNewValue();
            break;
        case "checkbox.location_widget":
            configuration.general.displayLocationWidget = (boolean) event.getNewValue();
            break;
        case "checkbox.numeric_hud_values":
            configuration.general.displayNumericHUDValues = (boolean) event.getNewValue();
            break;
        case "checkbox.display_names":
            configuration.general.displayNames = (boolean) event.getNewValue();
            break;
        case "checkbox.display_healthbars":
            configuration.general.displayHealthbars = (boolean) event.getNewValue();
            break;
        case "checkbox.disable_offhand_torch_placement":
            configuration.general.disableOffhandTorchPlacement = (boolean) event.getNewValue();
            break;
        case "checkbox.display_guide_on_login":
            configuration.general.displayGuideOnLogin = (boolean) event.getNewValue();
            break;
    }
    saveAndLoad();
}
Also used : ClientConfiguration(com.almuradev.almura.core.client.config.ClientConfiguration) Subscribe(com.google.common.eventbus.Subscribe)

Example 9 with ClientConfiguration

use of com.almuradev.almura.core.client.config.ClientConfiguration in project Almura by AlmuraDev.

the class AlmuraSettings method setFirstLaunched.

protected static void setFirstLaunched(boolean value) {
    final ClientConfiguration configuration = configAdapter.get();
    configuration.general.firstLaunch = value;
    saveAlmuraConfigs();
}
Also used : ClientConfiguration(com.almuradev.almura.core.client.config.ClientConfiguration)

Aggregations

ClientConfiguration (com.almuradev.almura.core.client.config.ClientConfiguration)9 EntityLivingBase (net.minecraft.entity.EntityLivingBase)4 Subscribe (com.google.common.eventbus.Subscribe)2 FontRenderer (net.minecraft.client.gui.FontRenderer)2 GameSettings (net.minecraft.client.settings.GameSettings)2 Inject (org.spongepowered.asm.mixin.injection.Inject)2 ResourcePackRepositoryAccessor (com.almuradev.almura.asm.mixin.accessors.client.resources.ResourcePackRepositoryAccessor)1 CacheBlock (com.almuradev.almura.feature.cache.block.CacheBlock)1 ISingleSlotItemHandler (com.almuradev.almura.shared.capability.ISingleSlotItemHandler)1 Block (net.minecraft.block.Block)1 ResourcePackRepository (net.minecraft.client.resources.ResourcePackRepository)1 ItemStack (net.minecraft.item.ItemStack)1 EnumFacing (net.minecraft.util.EnumFacing)1 BlockPos (net.minecraft.util.math.BlockPos)1 ITextComponent (net.minecraft.util.text.ITextComponent)1 Overwrite (org.spongepowered.asm.mixin.Overwrite)1