Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

small minecraft fixes #1981

Merged
merged 6 commits into from
Apr 28, 2020
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,18 @@
<StackPanel Margin="10">
<CheckBox x:Name="GameEnabled" Content="Enable Aurora to provide lighting effects with Minecraft. Ensure you have read the below text." Checked="GameEnabled_Checked" Unchecked="GameEnabled_Checked" />
<TextBlock HorizontalAlignment="Left" Margin="0,10" TextWrapping="Wrap" MaxWidth="824">
<Run Text="Support for Minecraft requires a mod so that Aurora is able to fetch the variables from the game. Currently this mod requires Forge mod loader, though other options may become available in future." />
<LineBreak /><LineBreak />
<Run Text="Support for Minecraft requires a mod so that Aurora is able to fetch the variables from the game."/>
<LineBreak />
<LineBreak />
<Run Text="Currently this mod requires either Forge or Fabric mod loader, depending on the version of the game."/>
<LineBreak />
<LineBreak />
<Run Text="These mods are not authored by the main Aurora developers and any issues with these mods should not be directed at them, but posted on the relevant GitLab repo for the mod." />
</TextBlock>

<Button Content="Minecraft Forge download" HorizontalAlignment="Left" Padding="10,2" Click="GoToForgePage_Click" />

<Button Content="Minecraft Fabric download" HorizontalAlignment="Left" Padding="10,2" Margin="0,10" Click="GoToFabricDownloadPage"/>

<TextBlock Margin="0,10,0,0" Text="Supported versions:" FontSize="13" FontWeight="Bold" />

Expand All @@ -35,7 +41,7 @@
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>

<TextBlock Text="{Binding Path=Name}" FontWeight="SemiBold" HorizontalAlignment="Stretch" Grid.Column="0" />
<TextBlock Grid.Column="1">
<Run Text="{Binding Path=Version}" />
Expand Down Expand Up @@ -87,7 +93,7 @@

<Label Content="Health:" Grid.Row="2" HorizontalAlignment="Right" Margin="8,0" />
<Slider Grid.Row="2" Grid.Column="1" Margin="0,4" ValueChanged="HealthSlider_ValueChanged" Minimum="0" Maximum="20" TickFrequency="1" IsSnapToTickEnabled="True" />

<Label Content="Absorption:" Grid.Row="3" HorizontalAlignment="Right" Margin="8,0" />
<Slider Grid.Row="3" Grid.Column="1" Margin="0,4" ValueChanged="Slider_ValueChanged" Minimum="0" Maximum="20" TickFrequency="1" IsSnapToTickEnabled="True" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ private void GoToModDownloadPage_Click(object sender, RoutedEventArgs e) {
Process.Start(((sender as Button).DataContext as ModDetails).Link);
}

private void GoToFabricDownloadPage(object sender, RoutedEventArgs e) {
Process.Start(@"https://fabricmc.net/");
}

private async void PopulateModList() {
ModList.Clear();
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
using System.Windows.Controls;

namespace Aurora.Profiles.Minecraft.Layers {

[Obsolete("This layer is obselete and has been replaced by the Overrides system.")]
public class MinecraftBurnLayerHandler : LayerHandler<LayerHandlerProperties> {

private List<FireParticle> particles = new List<FireParticle>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
using System.Windows.Controls;

namespace Aurora.Profiles.Minecraft.Layers {

[Obsolete("This layer is obselete and has been replaced by the Overrides system.")]
public class MinecraftHealthBarLayerHandlerProperties : LayerHandlerProperties<MinecraftHealthBarLayerHandlerProperties> {

[JsonIgnore]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
using System.Windows.Controls;

namespace Aurora.Profiles.Minecraft.Layers {

[Obsolete("This layer is obselete and has been replaced by the Overrides system.")]
public class MinecraftRainLayerHandlerProperties : LayerHandlerProperties<MinecraftRainLayerHandlerProperties> {

[JsonIgnore]
Expand Down
132 changes: 115 additions & 17 deletions Project-Aurora/Project-Aurora/Profiles/Minecraft/MinecraftProfile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Aurora.Settings.Overrides;
using Aurora.Settings.Overrides.Logic;
using Aurora.Settings.Overrides.Logic.Builder;
using Octokit;
using System;
using System.Collections.Generic;
using System.Drawing;
Expand All @@ -13,13 +14,16 @@
using System.Threading.Tasks;
using DK = Aurora.Devices.DeviceKeys;

namespace Aurora.Profiles.Minecraft {
namespace Aurora.Profiles.Minecraft
{

public class MinecraftProfile : ApplicationProfile {
public class MinecraftProfile : ApplicationProfile
{

public MinecraftProfile() : base() { }

public override void Reset() {
public override void Reset()
{
base.Reset();

// Keys that do something and should be highlighted in a static color
Expand All @@ -28,15 +32,26 @@ public override void Reset() {
Layers = new System.Collections.ObjectModel.ObservableCollection<Layer>() {
new Layer("Controls Assistant Layer", new MinecraftKeyConflictLayerHandler()),

new Layer("Health Bar", new MinecraftHealthBarLayerHandler() {
Properties = new MinecraftHealthBarLayerHandlerProperties() {
new Layer("Health Bar", new PercentLayerHandler() {
Properties = new PercentLayerHandlerProperties()
{
_VariablePath = "Player/Health",
_MaxVariablePath = "Player/HealthMax",
_PrimaryColor = Color.Red,
_SecondaryColor = Color.Transparent,
_Sequence = new KeySequence(new[] {
DK.Z, DK.X, DK.C, DK.V, DK.B, DK.N, DK.M, DK.COMMA, DK.PERIOD, DK.FORWARD_SLASH
})
}
},
new OverrideLogicBuilder()
.SetDynamicBoolean("_Enabled", new BooleanGSIBoolean("Player/InGame"))
.SetLookupTable("_PrimaryColor", new OverrideLookupTableBuilder<Color>()
.AddEntry(Color.FromArgb(255, 210, 0), new BooleanGSIBoolean("Player/PlayerEffects/HasAbsorption"))
.AddEntry(Color.FromArgb(240, 75, 100), new BooleanGSIBoolean("Player/PlayerEffects/HasRegeneration"))
.AddEntry(Color.FromArgb(145, 160, 30), new BooleanGSIBoolean("Player/PlayerEffects/HasPoison"))
.AddEntry(Color.FromArgb(70, 5, 5), new BooleanGSIBoolean("Player/PlayerEffects/HasWither"))
)
),

new Layer("Experience Bar", new PercentLayerHandler() {
Expand Down Expand Up @@ -77,7 +92,7 @@ public override void Reset() {
}
},
new OverrideLogicBuilder()
.SetDynamicBoolean("_Enabled", new BooleanAnd(new List<BooleanGSIBoolean>(new[] {
.SetDynamicBoolean("_Enabled", new BooleanAnd(new List<BooleanGSIBoolean>(new[] {
new BooleanGSIBoolean("Player/IsInWater"),new BooleanGSIBoolean("Player/InGame") }
)))
),
Expand Down Expand Up @@ -119,25 +134,96 @@ public override void Reset() {
.SetDynamicBoolean("_Enabled", new BooleanGSIBoolean("Player/InGame"))
),

new Layer("On Fire", new MinecraftBurnLayerHandler()),
new Layer("On Fire", new SimpleParticleLayerHandler()
{
Properties = new SimpleParticleLayerProperties()
{
_SpawnLocation = ParticleSpawnLocations.BottomEdge,
_ParticleColorStops = new Utils.ColorStopCollection()
{
{ 0f, Color.Orange },
{ 0.6f , Color.Red },
{ 1f, Color.Black }
},
_MinSpawnTime = 0.05f,
_MaxSpawnTime = 0.05f,
_MinSpawnAmount = 8,
_MaxSpawnAmount = 10,
_MinLifetime = 0.5f,
_MaxLifetime = 2f,
_MinInitialVelocityX = 0,
_MaxInitialVelocityX = 0,
_MinInitialVelocityY = -5f,
_MaxInitialVelocityY = -0.8f,
_AccelerationX = 0f,
_AccelerationY = 0.5f,
_MinSize = 8,
_MaxSize = 12,
_DeltaSize = -4,
}
},
new OverrideLogicBuilder()
.SetDynamicBoolean("_SpawningEnabled", new BooleanGSIBoolean("Player/IsBurning"))
),

new Layer("Raining", new MinecraftRainLayerHandler()),
new Layer("Raining", new SimpleParticleLayerHandler()
{
Properties = new SimpleParticleLayerProperties()
{
_SpawnLocation = ParticleSpawnLocations.TopEdge,
_ParticleColorStops = new Utils.ColorStopCollection
{
{ 0f, Color.Cyan },
{ 1f, Color.Cyan }
},
_MinSpawnTime = .1f,
_MaxSpawnTime = .2f,
_MinSpawnAmount = 1,
_MaxSpawnAmount = 2,
_MinLifetime = 1,
_MaxLifetime = 1,
_MinInitialVelocityX = 0,
_MaxInitialVelocityX = 0,
_MinInitialVelocityY =3,
_MaxInitialVelocityY = 3,
_AccelerationX = 0,
_AccelerationY = 0,
_MinSize = 2,
_MaxSize = 4,
_DeltaSize = 0,
}
},
new OverrideLogicBuilder()
.SetDynamicBoolean("_SpawningEnabled", new BooleanGSIBoolean("World/IsRaining"))
),

new Layer("Grass Block Top", new MinecraftBackgroundLayerHandler() {
Properties = new MinecraftBackgroundLayerHandlerProperties() {
_PrimaryColor = Color.FromArgb(44, 168, 32),
_SecondaryColor = Color.FromArgb(30, 80, 25),
_Sequence = new KeySequence(new FreeFormObject(0, -60, 900, 128))
}
},
},
new OverrideLogicBuilder()
.SetLookupTable("_PrimaryColor", new OverrideLookupTableBuilder<Color>()
.AddEntry(Color.FromArgb(125,42,123), new BooleanGSINumeric("World/DimensionID", 1))//The End
.AddEntry(Color.FromArgb(255,183,0), new BooleanGSINumeric("World/DimensionID", -1))//Nether
.AddEntry(Color.FromArgb(125,42,123), new BooleanAnd(new IEvaluatable<bool>[] {
new BooleanGSINumeric("World/DimensionID", 1),
new BooleanGSIBoolean("Player/InGame")
}))//The End
.AddEntry(Color.FromArgb(255,183,0), new BooleanAnd(new IEvaluatable<bool>[] {
new BooleanGSINumeric("World/DimensionID", -1),
new BooleanGSIBoolean("Player/InGame")
}))//The Nether
)
.SetLookupTable("_SecondaryColor", new OverrideLookupTableBuilder<Color>()
.AddEntry(Color.FromArgb(49,0,59), new BooleanGSINumeric("World/DimensionID", 1))//The End
.AddEntry(Color.FromArgb(87,83,0), new BooleanGSINumeric("World/DimensionID", -1))//Nether
.AddEntry(Color.FromArgb(49,0,59), new BooleanAnd(new IEvaluatable<bool>[] {
new BooleanGSINumeric("World/DimensionID", 1),
new BooleanGSIBoolean("Player/InGame")
}))//The End
.AddEntry(Color.FromArgb(87,83,0), new BooleanAnd(new IEvaluatable<bool>[] {
new BooleanGSINumeric("World/DimensionID", -1),
new BooleanGSIBoolean("Player/InGame")
}))//The Nether
)
),

Expand All @@ -149,12 +235,24 @@ public override void Reset() {
},
new OverrideLogicBuilder()
.SetLookupTable("_PrimaryColor", new OverrideLookupTableBuilder<Color>()
.AddEntry(Color.FromArgb(209,232,80), new BooleanGSINumeric("World/DimensionID", 1))//The End
.AddEntry(Color.FromArgb(184,26,0), new BooleanGSINumeric("World/DimensionID", -1))//Nether
.AddEntry(Color.FromArgb(209,232,80), new BooleanAnd(new IEvaluatable<bool>[] {
new BooleanGSINumeric("World/DimensionID", 1),
new BooleanGSIBoolean("Player/InGame")
}))//The End
.AddEntry(Color.FromArgb(184,26,0), new BooleanAnd(new IEvaluatable<bool>[] {
new BooleanGSINumeric("World/DimensionID", -1),
new BooleanGSIBoolean("Player/InGame")
}))//The Nether
)
.SetLookupTable("_SecondaryColor", new OverrideLookupTableBuilder<Color>()
.AddEntry(Color.FromArgb(107,102,49), new BooleanGSINumeric("World/DimensionID", 1))//The End
.AddEntry(Color.FromArgb(59,8,0), new BooleanGSINumeric("World/DimensionID", -1))//Nether
.AddEntry(Color.FromArgb(107,102,49),new BooleanAnd(new IEvaluatable<bool>[] {
new BooleanGSINumeric("World/DimensionID", 1),
new BooleanGSIBoolean("Player/InGame")
}))//The End
.AddEntry(Color.FromArgb(59,8,0), new BooleanAnd(new IEvaluatable<bool>[] {
new BooleanGSINumeric("World/DimensionID", -1),
new BooleanGSIBoolean("Player/InGame")
}))//The Nether
)
),
};
Expand Down