Skip to content

Commit

Permalink
update: 1.21
Browse files Browse the repository at this point in the history
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
  • Loading branch information
Octol1ttle committed Jul 22, 2024
1 parent 25b6593 commit 273ec4a
Show file tree
Hide file tree
Showing 9 changed files with 68 additions and 18 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ dependencies {
modImplementation "net.fabricmc:fabric-loader:${project.floader_version}"

// Embedded: Alternate HudRendererCallback to fix HUD not rendering behind chat
include(modImplementation "com.github.shadowhunt22:alternate-hudrenderercallback:${project.ahrc_version}")
//include(modImplementation "com.github.shadowhunt22:alternate-hudrenderercallback:${project.ahrc_version}")
// Required: Fabric API for callbacks
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fapi_version}+${project.minecraft_version}"
// Required: YACL for config storage and screen
Expand All @@ -63,7 +63,7 @@ dependencies {
// Optional: ImmediatelyFast for batching support to increase rendering performance
modApi "maven.modrinth:immediatelyfast:${project.immediatelyfast_version}+${project.minecraft_version}-fabric"
// Optional: Do a Barrel Roll to control roll via RollController
modApi "nl.enjarai:do-a-barrel-roll:${project.dabr_version}-fabric"
modApi "nl.enjarai:do-a-barrel-roll:${project.dabr_version}+${project.minecraft_version}-fabric"
}

processResources {
Expand Down
20 changes: 10 additions & 10 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ org.gradle.parallel=true

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.20.5
yarn_mappings=1.20.5+build.1
minecraft_version=1.21
yarn_mappings=1.21+build.2
floader_version=0.15.10

# Mod Properties
Expand All @@ -15,15 +15,15 @@ archives_base_name=flightassistant

# Dependencies
ahrc_version=1.20.5-1.0.0
fapi_version=0.97.5
yacl_version=3.4.0
modmenu_version=10.0.0-beta.1
immediatelyfast_version=1.2.12
dabr_version=3.5.7+1.20.6
fapi_version=0.100.1
yacl_version=3.5.0
modmenu_version=11.0.0
immediatelyfast_version=1.2.18
dabr_version=3.6.1
# Publish Properties
publish_target_min=1.20.5
publish_target_max=1.20.6
publish_target_min=1.21
publish_target_max=1.21
mod_modrinth=CWqLEOPt
mod_curseforge=972881
mod_github=Octol1ttle/FlightAssistant
git_branch=1.20.5/dev
git_branch=1.21/dev
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import com.mojang.brigadier.tree.LiteralCommandNode;
import com.shadowhunter22.api.client.renderer.v1.AlternateHudRendererCallback;
import java.util.Optional;
import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback;
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
Expand Down Expand Up @@ -39,6 +38,7 @@
import ru.octol1ttle.flightassistant.config.ComputerConfig;
import ru.octol1ttle.flightassistant.config.FAConfig;
import ru.octol1ttle.flightassistant.registries.ComputerRegistry;
import ru.octol1ttle.flightassistant.util.events.AlternateHudRendererCallback;
import ru.octol1ttle.flightassistant.util.events.ChangeLookDirectionEvents;
import ru.octol1ttle.flightassistant.util.events.FireworkBoostCallback;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public static ComputerHost getComputerHost() {
}

public static Identifier id(String path) {
return new Identifier(FlightAssistant.MODID, path);
return Identifier.of(FlightAssistant.MODID, path);
}

public static boolean isHUDBatched() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.llamalad7.mixinextras.sugar.Local;
import net.minecraft.client.render.GameRenderer;
import net.minecraft.client.render.RenderTickCounter;
import org.joml.Matrix4f;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
Expand All @@ -15,12 +16,12 @@ public class GameRendererMixin {
method = "renderWorld",
at = @At(
value = "INVOKE_ASSIGN",
target = "Lorg/joml/Matrix4f;rotationXYZ(FFF)Lorg/joml/Matrix4f;",
target = "Lorg/joml/Matrix4f;rotation(Lorg/joml/Quaternionfc;)Lorg/joml/Matrix4f;",
ordinal = 0,
remap = false
)
)
public void updateRoll(float tickDelta, long limitTime, CallbackInfo ci, @Local(ordinal = 1) Matrix4f matrix4f2) {
public void updateRoll(RenderTickCounter tickCounter, CallbackInfo ci, @Local(ordinal = 1) Matrix4f matrix4f2) {
RollMatrixCallback.EVENT.invoker().onMatrixUpdate(matrix4f2);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package ru.octol1ttle.flightassistant.mixin;

import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.LayeredDrawer;
import net.minecraft.client.gui.hud.InGameHud;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import ru.octol1ttle.flightassistant.util.events.AlternateHudRendererCallback;

@Mixin(InGameHud.class)
public class InGameHudMixin {
@Shadow
@Final
private LayeredDrawer layeredDrawer;

// modifications made: changed injection point
@Inject(method = "<init>", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/LayeredDrawer;addLayer(Lnet/minecraft/client/gui/LayeredDrawer$Layer;)Lnet/minecraft/client/gui/LayeredDrawer;", ordinal = 3))
public void render(MinecraftClient client, CallbackInfo ci) {
// modifications made: changed from FAPIs interface to my interface
this.layeredDrawer.addLayer((context, tickCounter) -> AlternateHudRendererCallback.EVENT.invoker().onHudRender(context, tickCounter.getTickDelta(true)));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package ru.octol1ttle.flightassistant.util.events;

import net.fabricmc.fabric.api.event.Event;
import net.fabricmc.fabric.api.event.EventFactory;
import net.minecraft.client.gui.DrawContext;

public interface AlternateHudRendererCallback {
// modifications mode: change HudRendererCallback -> AlternateHudRendererCallback
Event<AlternateHudRendererCallback> EVENT = EventFactory.createArrayBacked(AlternateHudRendererCallback.class, (listeners) -> (matrixStack, delta) -> {
for (AlternateHudRendererCallback event : listeners) {
event.onHudRender(matrixStack, delta);
}
});

/**
* Called after rendering the whole hud, which is displayed in game, in a world.
*
* @param drawContext the {@link DrawContext} instance
* @param tickDelta Progress for linearly interpolating between the previous and current game state
*/
void onHudRender(DrawContext drawContext, float tickDelta);
}
2 changes: 1 addition & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"depends": {
"fabricloader": ">=0.15.10",
"fabric-api": "*",
"minecraft": ">=1.20.5 <1.21",
"minecraft": "^1.21",
"java": ">=21",
"yet_another_config_lib_v3": "*"
},
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/flightassistant.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"EntityMixin",
"FireworkRocketEntityMixin",
"GameRendererInvoker",
"GameRendererMixin"
"GameRendererMixin",
"InGameHudMixin"
],
"injectors": {
"defaultRequire": 1
Expand Down

0 comments on commit 273ec4a

Please sign in to comment.