mirror of
https://github.com/darksaid98/Flashback.git
synced 2026-12-02 06:28:48 +00:00
0.7.0
This commit is contained in:
1 parent
7f1d199704
commit
be99313e81
47 files changed
+1247
-337
No files matched your search
@@ -1,7 +1,36 @@
|
||||
package com.moulberry.flashback.mixin.visuals;
|
||||
|
||||
import com.moulberry.flashback.Flashback;
|
||||
import net.minecraft.client.multiplayer.ClientLevel;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
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;
|
||||
|
||||
@Mixin(ClientLevel.class)
|
||||
public class MixinClientLevel {
|
||||
|
||||
/*
|
||||
* Some entities have weird behaviour when rotating in a replay
|
||||
* This code here ensures that the interpolation of yRotO -> yRot will always be the shortest path
|
||||
*/
|
||||
|
||||
@Inject(method = "tickNonPassenger", at = @At("RETURN"))
|
||||
public void tickNonPassengerEnd(Entity entity, CallbackInfo ci) {
|
||||
if (Flashback.isInReplay()) {
|
||||
entity.xRotO = Mth.wrapDegrees(entity.xRotO - entity.getXRot()) + entity.getXRot();
|
||||
entity.yRotO = Mth.wrapDegrees(entity.yRotO - entity.getYRot()) + entity.getYRot();
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "tickPassenger", at = @At("RETURN"))
|
||||
public void tickPassengerEnd(Entity vehicle, Entity entity, CallbackInfo ci) {
|
||||
if (Flashback.isInReplay()) {
|
||||
entity.xRotO = Mth.wrapDegrees(entity.xRotO - entity.getXRot()) + entity.getXRot();
|
||||
entity.yRotO = Mth.wrapDegrees(entity.yRotO - entity.getYRot()) + entity.getYRot();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -86,6 +86,14 @@ public abstract class MixinGui {
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "renderHotbarAndDecorations", at = @At("HEAD"), cancellable = true)
|
||||
public void renderHotbarAndDecorations(GuiGraphics guiGraphics, DeltaTracker deltaTracker, CallbackInfo ci) {
|
||||
EditorState editorState = EditorStateManager.getCurrent();
|
||||
if (editorState != null && !editorState.replayVisuals.showHotbar) {
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@WrapOperation(method = "renderHotbarAndDecorations", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/multiplayer/MultiPlayerGameMode;getPlayerMode()Lnet/minecraft/world/level/GameType;"))
|
||||
public GameType renderHotbarAndDecorations_getPlayerMode(MultiPlayerGameMode instance, Operation<GameType> original) {
|
||||
if (Flashback.isInReplay()) {
|
||||
|
||||
Reference in new issue
Block a user