Skip to content

Commit 721d191

Browse files
committed
update: 1.20.5
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
1 parent 8e6dea8 commit 721d191

File tree

10 files changed

+86
-33
lines changed

10 files changed

+86
-33
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
@@ -68,13 +68,13 @@ dependencies {
6868
// Required: Fabric API for callbacks
6969
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fapi_version}+${project.minecraft_version}"
7070
// Required: YACL for config storage and screen
71-
modImplementation "dev.isxander.yacl:yet-another-config-lib-fabric:${project.yacl_version}+${project.minecraft_version}"
71+
modImplementation "dev.isxander:yet-another-config-lib:${project.yacl_version}+${project.minecraft_version}-fabric"
7272
// Optional: Mod Menu to access the YACL config screen
7373
modApi "com.terraformersmc:modmenu:${project.modmenu_version}"
7474
// Optional: ImmediatelyFast for batching support to increase rendering performance
7575
modApi "maven.modrinth:immediatelyfast:${project.immediatelyfast_version}+${project.minecraft_version}-fabric"
7676
// Optional: Do a Barrel Roll to control roll via RollController
77-
modApi "nl.enjarai:do-a-barrel-roll:${project.dabr_version}+${project.minecraft_version}-fabric"
77+
modApi "nl.enjarai:do-a-barrel-roll:${project.dabr_version}-fabric"
7878
}
7979

8080
processResources {
@@ -91,7 +91,7 @@ yamlang {
9191
}
9292

9393
tasks.withType(JavaCompile).configureEach {
94-
it.options.release = 17
94+
it.options.release = 21
9595
}
9696

9797
java {
@@ -100,8 +100,8 @@ java {
100100
// If you remove this line, sources will not be generated.
101101
withSourcesJar()
102102

103-
sourceCompatibility = JavaVersion.VERSION_17
104-
targetCompatibility = JavaVersion.VERSION_17
103+
sourceCompatibility = JavaVersion.VERSION_21
104+
targetCompatibility = JavaVersion.VERSION_21
105105
}
106106

107107
jar {

gradle.properties

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,27 @@ 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.2
1313
maven_group=ru.octol1ttle.flightassistant
1414
archives_base_name=flightassistant
1515

1616
# Dependencies
17-
ahrc_version=1.20.x-0.1.3
18-
renderer_version=aa67e1c979
19-
fapi_version=0.96.4
20-
yacl_version=3.3.1
21-
modmenu_version=9.0.0
22-
immediatelyfast_version=1.2.8
23-
dabr_version=3.3.8
17+
ahrc_version=1.20.5-1.0.0
18+
renderer_version=b2f7b5e3bb
19+
fapi_version=0.97.5
20+
yacl_version=3.4.0
21+
modmenu_version=10.0.0-beta.1
22+
immediatelyfast_version=1.2.12
23+
dabr_version=3.5.7+1.20.6
2424
# Publish Properties
25-
publish_target_min=1.20
26-
publish_target_max=1.20.4
25+
publish_target_min=1.20.5
26+
publish_target_max=1.20.6
2727
mod_modrinth=CWqLEOPt
2828
mod_curseforge=972881
2929
mod_github=Octol1ttle/FlightAssistant
30-
git_branch=dev
30+
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,7 +1,6 @@
11
package ru.octol1ttle.flightassistant.computers.impl;
22

33
import com.google.common.collect.Iterables;
4-
import com.mojang.blaze3d.systems.RenderSystem;
54
import net.minecraft.block.BlockState;
65
import net.minecraft.client.MinecraftClient;
76
import net.minecraft.client.network.ClientPlayerEntity;
@@ -21,13 +20,14 @@
2120
import net.minecraft.world.World;
2221
import org.jetbrains.annotations.NotNull;
2322
import org.jetbrains.annotations.Nullable;
24-
import org.joml.Matrix3f;
23+
import org.joml.Matrix4f;
2524
import ru.octol1ttle.flightassistant.DrawHelper;
2625
import ru.octol1ttle.flightassistant.FAMathHelper;
2726
import ru.octol1ttle.flightassistant.computers.api.ITickableComputer;
2827
import ru.octol1ttle.flightassistant.config.ComputerConfig;
2928
import ru.octol1ttle.flightassistant.config.FAConfig;
3029
import ru.octol1ttle.flightassistant.config.IndicatorConfig;
30+
import ru.octol1ttle.flightassistant.util.events.RollMatrixCallback;
3131

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

@@ -45,13 +45,13 @@ public class AirDataComputer implements ITickableComputer {
4545

4646
public AirDataComputer(MinecraftClient mc) {
4747
this.mc = mc;
48+
RollMatrixCallback.EVENT.register(matrix4f -> roll = computeRoll(matrix4f));
4849
}
4950

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

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

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)