Skip to content

Commit ae95a9c

Browse files
authored
Merge branch 'lambda-client:master' into Jesus
2 parents 32e9cb9 + 205865d commit ae95a9c

File tree

20 files changed

+265
-129
lines changed

20 files changed

+265
-129
lines changed

.github/ISSUE_TEMPLATE/BUG_REPORT.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ labels: bug, -module
77
**Describe the bug**
88
<!-- A clear and concise description of what the bug is. -->
99

10-
**To Reproduce**
10+
**Steps to reproduce the bug**
1111
<!-- Steps to reproduce the behavior: -->
1212

1313
1. Go to '...'
@@ -19,7 +19,7 @@ labels: bug, -module
1919
<!-- A clear and concise description of what you expected to happen. -->
2020

2121
**Debug info**
22-
<!-- A screenshot or copy of the `;tsc` command output is required for valid bug reports -->
22+
<!-- A screenshot or copy of the `;tsc` command output is required for your bug report to be reviewed. -->
2323

2424
**Additional context / media**
2525
<!-- Add any other context about the problem here, such as a video or screenshot. -->

.github/ISSUE_TEMPLATE/ENHANCEMENT.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ about: Suggest an idea for a feature
44
labels: enhancement, -module
55
---
66

7-
**Is your feature request related to a problem? Please describe.**
7+
**Is your enhancement request related to a problem? Please describe.**
88
<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->
99

10-
**Describe the solution you'd like**
10+
**Describe the solution you'd like in order to enchance your experience.**
1111
<!-- A clear and concise description of what you want to happen. -->
1212

1313
**Describe alternatives you've considered**
1414
<!-- A clear and concise description of any alternative solutions or features you've considered. -->
1515

1616
**Additional context**
17-
<!-- Add any other context or screenshots about the feature request here. -->
17+
<!-- Add any other context or media about the enchancement request here. -->

.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ about: Suggest an idea for this project
44
labels: new, -module
55
---
66

7-
**Is your feature request related to a problem? Please describe.**
7+
**Is your feature request related to a problem? Please elaborate.**
88
<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->
99

10-
**Describe the solution you'd like**
10+
**Describe the solution or feature you'd like implemented.**
1111
<!-- A clear and concise description of what you want to happen. -->
1212

13-
**Describe alternatives you've considered**
13+
**Describe alternatives you've considered.**
1414
<!-- A clear and concise description of any alternative solutions or features you've considered. -->
1515

16-
**Additional context**
17-
<!-- Add any other context or screenshots about the feature request here. -->
16+
**Additional context:**
17+
<!-- Add any other context or media about the feature request here. -->

.github/ISSUE_TEMPLATE/INCOMPATIBILITY_REPORT.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@ about: Module incompatibility or incompatible with another Forge mod
44
labels: -incompatible
55
---
66

7-
**What mod?**
8-
<!-- A clear and concise description of what module it is. -->
7+
**What mod/module causes an issue?**
8+
<!-- Mention the problematic mod/module here. -->
99

10-
**Logs**
11-
<!-- Please add logs or your issue will be closed. -->
10+
**What issue is caused?**
11+
<!-- Provide a clear and concise description of the issue -->
12+
13+
**Please attach your Minecraft logs**
14+
<!-- Please add logs or your issue will be closed, as we need to see the logs to accurately troubleshoot. -->
1215

1316
**Additional context**
14-
<!-- Add any other context about the problem here. -->
17+
<!-- Add any other context about the problem here, such as a more detailed description, or attach related media. -->

README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ How do I...
3232
<details>
3333
<summary>... open the ClickGUI?</summary>
3434

35-
> Press `Y`
35+
> Press `Y`.
3636
3737
</details>
3838

3939
<details>
4040
<summary>... execute a command?</summary>
4141

42-
> Use the ingame chat with the prefix `;`
42+
> Use the ingame chat with the prefix `;`.
4343
4444
</details>
4545

@@ -55,15 +55,15 @@ How do I...
5555
<details>
5656
<summary>... export KAMI blue config to Lambda?</summary>
5757

58-
> Rename `.minecraft/kamiblue` to `.minecraft/lambda`
59-
> Note that this might cause stability issues.
58+
> Rename `.minecraft/kamiblue` to `.minecraft/lambda`.
59+
> Please note that this might cause stability issues.
6060
6161
</details>
6262

6363
<details>
6464
<summary>... fix most crashes on startup?</summary>
6565

66-
> Possibly you have multiple mods loaded. Forge loads mods in alphabetical order, so you can change the name of the Mod jar to make it load earlier or later. Add for example an exclamation mark to lambda jar to make it load first.
66+
> You may have multiple mods loaded. Forge loads mods in alphabetical order, so you can change the name of the Mod jar to make it load earlier or later. Add for example an exclamation mark to lambda jar to make it load first.
6767
> If you got `Error: java.lang.IllegalAccessError: tried to access field net.minecraft.util.math.Vec3i.field_177962_a from class baritone.k` remove the `-noverify` tag from your arguments.
6868
6969
</details>
@@ -72,21 +72,21 @@ How do I...
7272
<summary>... fix problems with Gradle?</summary>
7373

7474
> Make sure you have a Java 8 JDK installed and in your PATH.
75-
We recommend using the [Temurin](https://adoptium.net/?variant=openjdk8&jvmVariant=hotspot/) distribution of OpenJDK
75+
We advise using the [Temurin](https://adoptium.net/?variant=openjdk8&jvmVariant=hotspot/) distribution of OpenJDK.
7676

7777
</details>
7878

7979
<details>
8080
<summary>... reset the ClickGUI scale?</summary>
8181

82-
> Run the command `;set clickgui scale 100`
82+
> Run the command `;set clickgui scale 100`.
8383
8484
</details>
8585

8686
<details>
8787
<summary>... crashing with liteloader?</summary>
8888

89-
> Use liteloader as a forge mod, it is available [here](https://jenkins.liteloader.com/view/1.12.2/job/LiteLoader%201.12.2/lastSuccessfulBuild/artifact/build/libs/liteloader-1.12.2-SNAPSHOT-release.jar)
89+
> Use liteloader as a forge mod, it is available [here](https://jenkins.liteloader.com/view/1.12.2/job/LiteLoader%201.12.2/lastSuccessfulBuild/artifact/build/libs/liteloader-1.12.2-SNAPSHOT-release.jar).
9090
</details>
9191
9292
<p align="center">
@@ -103,24 +103,24 @@ git clone https://github.com/lambda-client/lambda
103103
```
104104

105105
Run `setupWorkspace.sh` to initialize the environment.
106-
With terminal on Linux or [Git Bash](https://gitforwindows.org/) for Windows
106+
Use your terminal on Linux or [Git Bash](https://gitforwindows.org/) for Windows.
107107
```
108108
./setupWorkspace.sh
109109
```
110110

111111
### Setup IDE
112112

113-
In this guide we will use [IntelliJ IDEA](https://www.jetbrains.com/idea/) as IDE.
113+
In this guide we will use [IntelliJ IDEA](https://www.jetbrains.com/idea/) as our IDE.
114114
1. Open the project from `File > Open...`
115115
2. Let the IDE collect dependencies and index the code.
116116
3. Goto `File > Project Structure... > SDKs` and make sure an SDK for Java 8 is installed and selected, if not download
117-
it [here](https://adoptium.net/?variant=openjdk8&jvmVariant=hotspot/)
117+
one [here](https://adoptium.net/?variant=openjdk8&jvmVariant=hotspot/).
118118

119119
### Gradle build
120120

121-
Test if the environment is set up correctly by building the client and run it inside IDE using the Gradle tab on the right side of the IDE.
121+
Test if the environment is set up correctly by building the client and running it inside the IDE using the Gradle tab on the right side of the IDE.
122122
1. Go to `lambda > Tasks > build > runClient` in the Gradle tab and run the client.
123-
2. To build the client as a jar run `lambda > Tasks > build > build`. Gradle will create a new directory called `build`. The final built jar will be in `build/libs`
123+
2. To build the client as a jar run `lambda > Tasks > build > build`. Gradle will create a new directory called `build`. The final built jar will be in `build/libs`.
124124

125125
## Thanks to
126126

@@ -138,4 +138,4 @@ Our [contributors](https://github.com/lambda-client/lambda/graphs/contributors)
138138
[![Stargazers](https://starchart.cc/lambda-client/lambda.svg)](https://starchart.cc/lambda-client/lambda)
139139

140140
> ### Disclaimer
141-
> This software does not contain any copyrighted Minecraft code. This is a Forge utility mod, Only meant for use in anarchy environments. Do not use without permission of server administration.
141+
> This software does not contain any copyrighted Minecraft code. This is a Forge utility mod, only meant for use in anarchy environments. Do not use without permission of server administration.

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ forgeVersion=14.23.5.2860
1010
mappingsChannel=stable
1111
mappingsVersion=39-1.12
1212

13-
kotlinVersion=1.7.10
13+
kotlinVersion=1.7.20
1414
kotlinxCoroutinesVersion=1.6.4

logo_ascii.txt

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
1-
2-
3-
//////
4-
*////////((
5-
***////////((((((
6-
**////////((((((((
7-
/////((((((((#
8-
//((((((((##%
9-
((((((((###&
10-
(((((((####&&
11-
((((((((###%%%
12-
((((((((###%%%%%
13-
/((((((((##%%%%%%%
14-
//((((((((#%%%%%%%%%
15-
////((((((((%%%%%%%%%%%#
16-
/////((((((( %%%%%#######
17-
///////((((( #############
18-
////////(((( ############
19-
*////////((/ #############
20-
*////////( /##########
21-
///// #####
22-
23-
1+
#######
2+
#############
3+
#################
4+
#####################
5+
*######################
6+
####################
7+
##################
8+
,,###############
9+
,,,,#############
10+
,,,,,,,##########
11+
.///,,,,,,,########
12+
..////////,,,,,#####
13+
....////////////,,,##
14+
**....//////////////////
15+
*****,.../////////////////
16+
**********../////////////////
17+
***************/////////////////
18+
***************** /////////////////
19+
**************** /////////////////
20+
**************** /////////////////
21+
**************** /////////////////
22+
**************** */////////////////
23+
*************** ////////////////
24+
************* //////////////
25+
******** ///////
26+
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package com.lambda;
2+
3+
import com.lambda.client.module.modules.movement.ElytraFlight;
4+
import com.lambda.mixin.accessor.AccessorEntityFireworkRocket;
5+
import com.lambda.mixin.entity.MixinEntityLivingBase;
6+
import net.minecraft.client.entity.EntityPlayerSP;
7+
import net.minecraft.entity.EntityLivingBase;
8+
9+
/**
10+
* Using {@link AccessorEntityFireworkRocket} in {@link MixinEntityLivingBase} causes a crash on older
11+
* Mixin versions (like the one Impact uses). Putting the methods using AccessorEntityFireworkRocket outside
12+
* the MixinEntityLivingBase seems to fix the issue.
13+
*/
14+
public class EntityLivingBaseFireworkHelper {
15+
public static boolean shouldWork(EntityLivingBase entity) {
16+
return EntityPlayerSP.class.isAssignableFrom(entity.getClass())
17+
&& ElytraFlight.INSTANCE.isEnabled()
18+
&& ElytraFlight.INSTANCE.getMode().getValue() == ElytraFlight.ElytraFlightMode.VANILLA;
19+
}
20+
21+
public static boolean shouldModify(EntityLivingBase entity) {
22+
return shouldWork(entity) && entity.world.loadedEntityList.stream().anyMatch(firework -> {
23+
if (firework instanceof AccessorEntityFireworkRocket) {
24+
EntityLivingBase boosted = ((AccessorEntityFireworkRocket) firework).getBoostedEntity();
25+
return boosted != null && boosted.equals(entity);
26+
}
27+
28+
return false;
29+
}
30+
);
31+
}
32+
33+
}

src/main/java/com/lambda/mixin/entity/MixinEntityLivingBase.java

Lines changed: 6 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
package com.lambda.mixin.entity;
22

3+
import com.lambda.EntityLivingBaseFireworkHelper;
34
import com.lambda.client.module.modules.movement.ElytraFlight;
4-
import net.minecraft.client.entity.EntityPlayerSP;
55
import net.minecraft.entity.Entity;
66
import net.minecraft.entity.EntityLivingBase;
7-
import net.minecraft.entity.item.EntityFireworkRocket;
87
import net.minecraft.util.math.MathHelper;
98
import net.minecraft.util.math.Vec3d;
109
import net.minecraft.world.World;
11-
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
1210
import org.objectweb.asm.Opcodes;
1311
import org.spongepowered.asm.mixin.Mixin;
1412
import org.spongepowered.asm.mixin.Unique;
@@ -19,19 +17,10 @@
1917
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
2018
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
2119

22-
import java.lang.reflect.Field;
23-
2420
@Mixin(EntityLivingBase.class)
2521
public abstract class MixinEntityLivingBase extends Entity {
2622
@Unique
2723
private Vec3d modifiedVec = null;
28-
// This is a bit silly and bad for performance but fixes compatibility with old mixin versions like the one used by impact
29-
@Unique
30-
private static final Field boostedEntity;
31-
32-
static {
33-
boostedEntity = ObfuscationReflectionHelper.findField(EntityFireworkRocket.class, "field_191513_e");
34-
}
3524

3625
public MixinEntityLivingBase(World worldIn) {
3726
super(worldIn);
@@ -42,7 +31,7 @@ public MixinEntityLivingBase(World worldIn) {
4231
at = @At(value = "INVOKE_ASSIGN", target = "Lnet/minecraft/entity/EntityLivingBase;getLookVec()Lnet/minecraft/util/math/Vec3d;", ordinal = 0)
4332
)
4433
private Vec3d vec3d(Vec3d original) {
45-
if (shouldWork()) {
34+
if (EntityLivingBaseFireworkHelper.shouldWork(EntityLivingBase.class.cast(this))) {
4635
float negPacketPitch = -ElytraFlight.INSTANCE.getPacketPitch();
4736
float f0 = MathHelper.cos((float) (-this.rotationYaw * 0.017453292f - Math.PI));
4837
float f1 = MathHelper.sin((float) (-this.rotationYaw * 0.017453292f - Math.PI));
@@ -60,7 +49,7 @@ private Vec3d vec3d(Vec3d original) {
6049
ordinal = 3
6150
)
6251
private float f(float original) {
63-
if (shouldWork()) {
52+
if (EntityLivingBaseFireworkHelper.shouldWork(EntityLivingBase.class.cast(this))) {
6453
return ElytraFlight.INSTANCE.getPacketPitch() * 0.017453292f;
6554
}
6655
return original;
@@ -87,7 +76,7 @@ private void getVec(
8776
at = @At(value = "FIELD", opcode = Opcodes.GETFIELD, target = "Lnet/minecraft/entity/EntityLivingBase;motionX:D", ordinal = 7)
8877
)
8978
public double motionX(EntityLivingBase it) {
90-
if (shouldModify()) {
79+
if (EntityLivingBaseFireworkHelper.shouldModify(EntityLivingBase.class.cast(this))) {
9180
it.motionX += modifiedVec.x * 0.1 + (modifiedVec.x * 1.5 - this.motionX) * 0.5;
9281
}
9382
return it.motionX;
@@ -98,7 +87,7 @@ public double motionX(EntityLivingBase it) {
9887
at = @At(value = "FIELD", opcode = Opcodes.GETFIELD, target = "Lnet/minecraft/entity/EntityLivingBase;motionY:D", ordinal = 7)
9988
)
10089
public double motionY(EntityLivingBase it) {
101-
if (shouldModify()) {
90+
if (EntityLivingBaseFireworkHelper.shouldModify(EntityLivingBase.class.cast(this))) {
10291
it.motionY += modifiedVec.y * 0.1 + (modifiedVec.y * 1.5 - this.motionY) * 0.5;
10392
}
10493
return it.motionY;
@@ -109,32 +98,10 @@ public double motionY(EntityLivingBase it) {
10998
at = @At(value = "FIELD", opcode = Opcodes.GETFIELD, target = "Lnet/minecraft/entity/EntityLivingBase;motionZ:D", ordinal = 7)
11099
)
111100
public double motionZ(EntityLivingBase it) {
112-
if (shouldModify()) {
101+
if (EntityLivingBaseFireworkHelper.shouldModify(EntityLivingBase.class.cast(this))) {
113102
it.motionZ += modifiedVec.z * 0.1 + (modifiedVec.z * 1.5 - this.motionZ) * 0.5;
114103
}
115104
return it.motionZ;
116105
}
117106

118-
@Unique
119-
private boolean shouldWork() {
120-
return EntityPlayerSP.class.isAssignableFrom(getClass())
121-
&& ElytraFlight.INSTANCE.isEnabled()
122-
&& ElytraFlight.INSTANCE.getMode().getValue() == ElytraFlight.ElytraFlightMode.VANILLA;
123-
}
124-
125-
@Unique
126-
private boolean shouldModify() {
127-
return shouldWork() && world.loadedEntityList.stream().anyMatch(entity -> {
128-
if (entity instanceof EntityFireworkRocket) {
129-
try {
130-
EntityLivingBase boosted = (EntityLivingBase) boostedEntity.get(entity);
131-
return boosted != null && boosted.equals(this);
132-
} catch (IllegalAccessException e) {
133-
throw new RuntimeException(e); // This should absolutely never happen
134-
}
135-
}
136-
return false;
137-
}
138-
);
139-
}
140107
}

src/main/kotlin/com/lambda/client/capeapi/AbstractUUIDManager.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ abstract class AbstractUUIDManager(
8080
try {
8181
val jsonElement = parser.parse(response)
8282
if (isUUID) {
83-
val name = jsonElement.asJsonArray.last().asJsonObject["name"].asString
83+
val name = jsonElement.asJsonObject["name"].asString
8484
PlayerProfile(UUID.fromString(nameOrUUID), name)
8585
} else {
8686
val id = jsonElement.asJsonObject["id"].asString
@@ -95,7 +95,7 @@ abstract class AbstractUUIDManager(
9595
}
9696

9797
private fun requestProfileFromUUID(uuid: String): String? {
98-
return request("https://api.mojang.com/user/profiles/${UUIDUtils.removeDashes(uuid)}/names")
98+
return request("https://sessionserver.mojang.com/session/minecraft/profile/${UUIDUtils.removeDashes(uuid)}")
9999
}
100100

101101
private fun requestProfileFromName(name: String): String? {

0 commit comments

Comments
 (0)