Skip to content

Commit 1aa7d1e

Browse files
committed
update: 1.20.5
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
1 parent d696ee2 commit 1aa7d1e

File tree

10 files changed

+85
-32
lines changed

10 files changed

+85
-32
lines changed

.github/workflows/build.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ jobs:
77
matrix:
88
# Use these Java versions
99
java: [
10-
17, # Current Java LTS & minimum supported by Minecraft
1110
21, # Current Java LTS
1211
]
1312
runs-on: ubuntu-22.04

build.gradle

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,13 @@ dependencies {
6666
// Required: Fabric API for callbacks
6767
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fapi_version}+${project.minecraft_version}"
6868
// Required: YACL for config storage and screen
69-
modImplementation "dev.isxander.yacl:yet-another-config-lib-fabric:${project.yacl_version}+${project.minecraft_version}"
69+
modImplementation "dev.isxander:yet-another-config-lib:${project.yacl_version}+${project.minecraft_version}-fabric"
7070
// Optional: Mod Menu to access the YACL config screen
7171
modApi "com.terraformersmc:modmenu:${project.modmenu_version}"
7272
// Optional: ImmediatelyFast for batching support to increase rendering performance
7373
modApi "maven.modrinth:immediatelyfast:${project.immediatelyfast_version}+${project.minecraft_version}-fabric"
7474
// Optional: Do a Barrel Roll to control roll via RollController
75-
modApi "nl.enjarai:do-a-barrel-roll:${project.dabr_version}+${project.minecraft_version}-fabric"
75+
modApi "nl.enjarai:do-a-barrel-roll:${project.dabr_version}-fabric"
7676
}
7777

7878
processResources {
@@ -89,7 +89,7 @@ yamlang {
8989
}
9090

9191
tasks.withType(JavaCompile).configureEach {
92-
it.options.release = 17
92+
it.options.release = 21
9393
}
9494

9595
java {
@@ -98,8 +98,8 @@ java {
9898
// If you remove this line, sources will not be generated.
9999
withSourcesJar()
100100

101-
sourceCompatibility = JavaVersion.VERSION_17
102-
targetCompatibility = JavaVersion.VERSION_17
101+
sourceCompatibility = JavaVersion.VERSION_21
102+
targetCompatibility = JavaVersion.VERSION_21
103103
}
104104

105105
jar {

gradle.properties

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,26 @@ org.gradle.parallel=true
44

55
# Fabric Properties
66
# check these on https://fabricmc.net/develop
7-
minecraft_version=1.20.4
8-
yarn_mappings=1.20.4+build.3
9-
floader_version=0.15.3
7+
minecraft_version=1.20.5
8+
yarn_mappings=1.20.5+build.1
9+
floader_version=0.15.10
1010

1111
# Mod Properties
1212
mod_version=2.3.4
1313
maven_group=ru.octol1ttle.flightassistant
1414
archives_base_name=flightassistant
1515

1616
# Dependencies
17-
ahrc_version=1.20.x-0.1.3
18-
fapi_version=0.96.4
19-
yacl_version=3.3.1
20-
modmenu_version=9.0.0
21-
immediatelyfast_version=1.2.8
22-
dabr_version=3.3.8
17+
ahrc_version=1.20.5-1.0.0
18+
fapi_version=0.97.5
19+
yacl_version=3.4.0
20+
modmenu_version=10.0.0-beta.1
21+
immediatelyfast_version=1.2.12
22+
dabr_version=3.5.7+1.20.6
2323
# Publish Properties
24-
publish_target_min=1.20
25-
publish_target_max=1.20.4
24+
publish_target_min=1.20.5
25+
publish_target_max=1.20.6
2626
mod_modrinth=CWqLEOPt
2727
mod_curseforge=972881
2828
mod_github=Octol1ttle/FlightAssistant
29-
git_branch=dev
29+
git_branch=1.20.5/dev

src/main/java/ru/octol1ttle/flightassistant/computers/impl/AirDataComputer.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package ru.octol1ttle.flightassistant.computers.impl;
22

3-
import com.mojang.blaze3d.systems.RenderSystem;
43
import net.minecraft.block.BlockState;
54
import net.minecraft.client.MinecraftClient;
65
import net.minecraft.client.network.ClientPlayerEntity;
@@ -20,13 +19,14 @@
2019
import net.minecraft.world.World;
2120
import org.jetbrains.annotations.NotNull;
2221
import org.jetbrains.annotations.Nullable;
23-
import org.joml.Matrix3f;
22+
import org.joml.Matrix4f;
2423
import ru.octol1ttle.flightassistant.DrawHelper;
2524
import ru.octol1ttle.flightassistant.FAMathHelper;
2625
import ru.octol1ttle.flightassistant.computers.api.ITickableComputer;
2726
import ru.octol1ttle.flightassistant.config.ComputerConfig;
2827
import ru.octol1ttle.flightassistant.config.FAConfig;
2928
import ru.octol1ttle.flightassistant.config.IndicatorConfig;
29+
import ru.octol1ttle.flightassistant.util.events.RollMatrixCallback;
3030

3131
import static net.minecraft.SharedConstants.TICKS_PER_SECOND;
3232

@@ -44,13 +44,13 @@ public class AirDataComputer implements ITickableComputer {
4444

4545
public AirDataComputer(MinecraftClient mc) {
4646
this.mc = mc;
47+
RollMatrixCallback.EVENT.register(matrix4f -> roll = computeRoll(matrix4f));
4748
}
4849

4950
@Override
5051
public void tick() {
5152
velocity = player().getVelocity().multiply(TICKS_PER_SECOND);
5253
forwardVelocity = computeForwardVelocity();
53-
roll = computeRoll(RenderSystem.getInverseViewRotationMatrix().invert());
5454
isCurrentChunkLoaded = isCurrentChunkLoaded();
5555
groundLevel = computeGroundLevel();
5656
flightPitch = computeFlightPitch(velocity, pitch());
@@ -93,7 +93,7 @@ private Vec3d computeForwardVelocity() {
9393
return new Vec3d(Math.max(0.0, lookVelocity.x), Math.max(0.0, lookVelocity.y), Math.max(0.0, lookVelocity.z));
9494
}
9595

96-
private float computeRoll(Matrix3f matrix) {
96+
private float computeRoll(Matrix4f matrix) {
9797
return validate(FAMathHelper.toDegrees(Math.atan2(-matrix.m10(), matrix.m11())), -180.0f, 180.0f);
9898
}
9999

src/main/java/ru/octol1ttle/flightassistant/computers/impl/autoflight/FireworkController.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
package ru.octol1ttle.flightassistant.computers.impl.autoflight;
22

33
import net.minecraft.client.MinecraftClient;
4+
import net.minecraft.component.DataComponentTypes;
5+
import net.minecraft.component.type.FireworksComponent;
46
import net.minecraft.entity.player.PlayerInventory;
57
import net.minecraft.item.FireworkRocketItem;
68
import net.minecraft.item.ItemStack;
7-
import net.minecraft.nbt.NbtCompound;
8-
import net.minecraft.nbt.NbtElement;
99
import net.minecraft.util.Hand;
1010
import ru.octol1ttle.flightassistant.computers.api.IThrustHandler;
1111
import ru.octol1ttle.flightassistant.computers.api.ITickableComputer;
@@ -129,8 +129,12 @@ public boolean isFireworkSafe(ItemStack stack) {
129129
if (data.isInvulnerable()) {
130130
return true;
131131
}
132-
NbtCompound nbtCompound = stack.getSubNbt("Fireworks");
133-
return nbtCompound == null || nbtCompound.getList("Explosions", NbtElement.COMPOUND_TYPE).isEmpty();
132+
133+
FireworksComponent component = stack.getComponents().get(DataComponentTypes.FIREWORKS);
134+
if (component == null) {
135+
throw new IllegalStateException();
136+
}
137+
return component.explosions().isEmpty();
134138
}
135139

136140
@Override

src/main/java/ru/octol1ttle/flightassistant/config/FAConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public static IndicatorConfig indicator() {
6666
}
6767

6868
if (!client.player.getAbilities().allowFlying) {
69-
for (ItemStack stack : client.player.getItemsEquipped()) {
69+
for (ItemStack stack : client.player.getEquippedItems()) {
7070
if (Items.ELYTRA.equals(stack.getItem())) {
7171
return INDICATORS_STORAGE_HANDLER.instance().notFlyingHasElytra;
7272
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package ru.octol1ttle.flightassistant.mixin;
2+
3+
import com.llamalad7.mixinextras.sugar.Local;
4+
import net.minecraft.client.render.GameRenderer;
5+
import org.joml.Matrix4f;
6+
import org.spongepowered.asm.mixin.Mixin;
7+
import org.spongepowered.asm.mixin.injection.At;
8+
import org.spongepowered.asm.mixin.injection.Inject;
9+
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
10+
import ru.octol1ttle.flightassistant.util.events.RollMatrixCallback;
11+
12+
@Mixin(GameRenderer.class)
13+
public class GameRendererMixin {
14+
@Inject(
15+
method = "renderWorld",
16+
at = @At(
17+
value = "INVOKE_ASSIGN",
18+
target = "Lorg/joml/Matrix4f;rotationXYZ(FFF)Lorg/joml/Matrix4f;",
19+
ordinal = 0,
20+
remap = false
21+
)
22+
)
23+
public void updateRoll(float tickDelta, long limitTime, CallbackInfo ci, @Local(ordinal = 1) Matrix4f matrix4f2) {
24+
RollMatrixCallback.EVENT.invoker().onMatrixUpdate(matrix4f2);
25+
}
26+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package ru.octol1ttle.flightassistant.util.events;
2+
3+
import net.fabricmc.fabric.api.event.Event;
4+
import net.fabricmc.fabric.api.event.EventFactory;
5+
import org.joml.Matrix4f;
6+
7+
public interface RollMatrixCallback {
8+
Event<RollMatrixCallback> EVENT = EventFactory.createArrayBacked(
9+
RollMatrixCallback.class,
10+
(listeners) -> (matrix4f) -> {
11+
for (RollMatrixCallback event : listeners) {
12+
event.onMatrixUpdate(matrix4f);
13+
}
14+
}
15+
);
16+
17+
/**
18+
* Called after the roll matrix has been updated
19+
*
20+
* @param matrix4f the roll matrix
21+
*/
22+
void onMatrixUpdate(Matrix4f matrix4f);
23+
}

src/main/resources/fabric.mod.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@
3535
"flightassistant.mixins.json"
3636
],
3737
"depends": {
38-
"fabricloader": ">=0.15.3",
38+
"fabricloader": ">=0.15.10",
3939
"fabric-api": "*",
40-
"minecraft": ">=1.20.0 <1.20.5",
41-
"java": ">=17",
40+
"minecraft": ">=1.20.5 <1.21",
41+
"java": ">=21",
4242
"yet_another_config_lib_v3": "*"
4343
},
4444
"recommends": {

src/main/resources/flightassistant.mixins.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
{
22
"required": true,
33
"package": "ru.octol1ttle.flightassistant.mixin",
4-
"compatibilityLevel": "JAVA_17",
4+
"compatibilityLevel": "JAVA_21",
55
"mixins": [],
66
"client": [
77
"EntityMixin",
88
"FireworkRocketEntityMixin",
9-
"GameRendererInvoker"
9+
"GameRendererInvoker",
10+
"GameRendererMixin"
1011
],
1112
"injectors": {
1213
"defaultRequire": 1

0 commit comments

Comments
 (0)