-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
- Loading branch information
1 parent
d696ee2
commit 1aa7d1e
Showing
10 changed files
with
85 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/main/java/ru/octol1ttle/flightassistant/mixin/GameRendererMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package ru.octol1ttle.flightassistant.mixin; | ||
|
||
import com.llamalad7.mixinextras.sugar.Local; | ||
import net.minecraft.client.render.GameRenderer; | ||
import org.joml.Matrix4f; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
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.RollMatrixCallback; | ||
|
||
@Mixin(GameRenderer.class) | ||
public class GameRendererMixin { | ||
@Inject( | ||
method = "renderWorld", | ||
at = @At( | ||
value = "INVOKE_ASSIGN", | ||
target = "Lorg/joml/Matrix4f;rotationXYZ(FFF)Lorg/joml/Matrix4f;", | ||
ordinal = 0, | ||
remap = false | ||
) | ||
) | ||
public void updateRoll(float tickDelta, long limitTime, CallbackInfo ci, @Local(ordinal = 1) Matrix4f matrix4f2) { | ||
RollMatrixCallback.EVENT.invoker().onMatrixUpdate(matrix4f2); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
src/main/java/ru/octol1ttle/flightassistant/util/events/RollMatrixCallback.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package ru.octol1ttle.flightassistant.util.events; | ||
|
||
import net.fabricmc.fabric.api.event.Event; | ||
import net.fabricmc.fabric.api.event.EventFactory; | ||
import org.joml.Matrix4f; | ||
|
||
public interface RollMatrixCallback { | ||
Event<RollMatrixCallback> EVENT = EventFactory.createArrayBacked( | ||
RollMatrixCallback.class, | ||
(listeners) -> (matrix4f) -> { | ||
for (RollMatrixCallback event : listeners) { | ||
event.onMatrixUpdate(matrix4f); | ||
} | ||
} | ||
); | ||
|
||
/** | ||
* Called after the roll matrix has been updated | ||
* | ||
* @param matrix4f the roll matrix | ||
*/ | ||
void onMatrixUpdate(Matrix4f matrix4f); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters