This commit is contained in:
Moulberry committed 2024-09-30 20:00:24 +08:00
1 parent be99313e81
commit 63535e6b3d
79 files changed
+2007 -529

No files matched your search

@@ -12,7 +12,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(BossHealthOverlay.class)
public class MixinBossHealthOverlay {
@Inject(method = "render", at = @At("HEAD"), cancellable = true)
@Inject(method = "render", at = @At("HEAD"), cancellable = true, require = 0)
public void render(GuiGraphics guiGraphics, CallbackInfo ci) {
EditorState editorState = EditorStateManager.getCurrent();
if (editorState != null && !editorState.replayVisuals.showBossBar) {
@@ -17,7 +17,7 @@ public class MixinClientLevel {
* This code here ensures that the interpolation of yRotO -> yRot will always be the shortest path
*/
@Inject(method = "tickNonPassenger", at = @At("RETURN"))
@Inject(method = "tickNonPassenger", at = @At("RETURN"), require = 0)
public void tickNonPassengerEnd(Entity entity, CallbackInfo ci) {
if (Flashback.isInReplay()) {
entity.xRotO = Mth.wrapDegrees(entity.xRotO - entity.getXRot()) + entity.getXRot();
@@ -25,7 +25,7 @@ public class MixinClientLevel {
}
}
@Inject(method = "tickPassenger", at = @At("RETURN"))
@Inject(method = "tickPassenger", at = @At("RETURN"), require = 0)
public void tickPassengerEnd(Entity vehicle, Entity entity, CallbackInfo ci) {
if (Flashback.isInReplay()) {
entity.xRotO = Mth.wrapDegrees(entity.xRotO - entity.getXRot()) + entity.getXRot();
@@ -12,7 +12,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(ClientLevel.ClientLevelData.class)
public class MixinClientLevelData {
@Inject(method = "getDayTime", at = @At("HEAD"), cancellable = true)
@Inject(method = "getDayTime", at = @At("HEAD"), cancellable = true, require = 0)
public void getDayTime(CallbackInfoReturnable<Long> cir) {
EditorState editorState = EditorStateManager.getCurrent();
if (editorState != null && editorState.replayVisuals.overrideTimeOfDay >= 0) {
@@ -36,7 +36,7 @@ public abstract class MixinEntityRenderDispatcher {
}
// Add a yellow outline to selected entity
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/vertex/PoseStack;popPose()V", shift = At.Shift.BEFORE))
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/vertex/PoseStack;popPose()V", shift = At.Shift.BEFORE), require = 0)
public void renderAfter(Entity entity, double d, double e, double f, float g, float h, PoseStack poseStack, MultiBufferSource multiBufferSource, int i, CallbackInfo ci) {
if (Flashback.isInReplay()) {
if (ReplayUI.isEntitySelected(entity.getUUID())) {
@@ -51,7 +51,7 @@ public abstract class MixinEntityRenderDispatcher {
}
// Prevent rendering shadows when blocks are turned off
@WrapWithCondition(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/entity/EntityRenderDispatcher;renderShadow(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;Lnet/minecraft/world/entity/Entity;FFLnet/minecraft/world/level/LevelReader;F)V"))
@WrapWithCondition(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/entity/EntityRenderDispatcher;renderShadow(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;Lnet/minecraft/world/entity/Entity;FFLnet/minecraft/world/level/LevelReader;F)V"), require = 0)
public boolean renderShadow(PoseStack poseStack, MultiBufferSource multiBufferSource, Entity entity, float f, float g, LevelReader levelReader, float h) {
EditorState editorState = EditorStateManager.getCurrent();
return editorState == null || editorState.replayVisuals.renderBlocks;
@@ -15,11 +15,17 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(EntityRenderer.class)
public class MixinEntityRenderer {
@Inject(method = "renderNameTag", at = @At("HEAD"), cancellable = true)
@Inject(method = "renderNameTag", at = @At("HEAD"), cancellable = true, require = 0)
public void renderNameTag(Entity entity, Component component, PoseStack poseStack, MultiBufferSource multiBufferSource, int i, float f, CallbackInfo ci) {
EditorState editorState = EditorStateManager.getCurrent();
if (editorState != null && !editorState.replayVisuals.renderNametags) {
ci.cancel();
if (editorState != null) {
if (!editorState.replayVisuals.renderNametags) {
ci.cancel();
} else if (editorState.hideNametags.contains(entity.getUUID())) {
ci.cancel();
} else if (editorState.hideDuringExport.contains(entity.getUUID())) {
ci.cancel();
}
}
}
@@ -14,7 +14,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(FogRenderer.class)
public class MixinFogRenderer {
@Inject(method = "setupFog", at = @At("HEAD"), cancellable = true)
@Inject(method = "setupFog", at = @At("HEAD"), cancellable = true, require = 0)
private static void setupFog(Camera camera, FogRenderer.FogMode fogMode, float f, boolean bl, float g, CallbackInfo ci) {
EditorState editorState = EditorStateManager.getCurrent();
if (editorState != null && editorState.replayVisuals.overrideFog) {
@@ -54,7 +54,7 @@ public abstract class MixinGui {
}
}
@Inject(method = "renderChat", at = @At("HEAD"), cancellable = true)
@Inject(method = "renderChat", at = @At("HEAD"), cancellable = true, require = 0)
public void renderChat(GuiGraphics guiGraphics, DeltaTracker deltaTracker, CallbackInfo ci) {
EditorState editorState = EditorStateManager.getCurrent();
if (editorState != null && !editorState.replayVisuals.showChat) {
@@ -62,7 +62,7 @@ public abstract class MixinGui {
}
}
@Inject(method = "renderTitle", at = @At("HEAD"), cancellable = true)
@Inject(method = "renderTitle", at = @At("HEAD"), cancellable = true, require = 0)
public void renderTitle(GuiGraphics guiGraphics, DeltaTracker deltaTracker, CallbackInfo ci) {
EditorState editorState = EditorStateManager.getCurrent();
if (editorState != null && !editorState.replayVisuals.showTitleText) {
@@ -70,7 +70,7 @@ public abstract class MixinGui {
}
}
@Inject(method = "renderScoreboardSidebar", at = @At("HEAD"), cancellable = true)
@Inject(method = "renderScoreboardSidebar", at = @At("HEAD"), cancellable = true, require = 0)
public void renderScoreboardSidebar(GuiGraphics guiGraphics, DeltaTracker deltaTracker, CallbackInfo ci) {
EditorState editorState = EditorStateManager.getCurrent();
if (editorState != null && !editorState.replayVisuals.showScoreboard) {
@@ -78,7 +78,7 @@ public abstract class MixinGui {
}
}
@Inject(method = "renderOverlayMessage", at = @At("HEAD"), cancellable = true)
@Inject(method = "renderOverlayMessage", at = @At("HEAD"), cancellable = true, require = 0)
public void renderOverlayMessage(GuiGraphics guiGraphics, DeltaTracker deltaTracker, CallbackInfo ci) {
EditorState editorState = EditorStateManager.getCurrent();
if (editorState != null && !editorState.replayVisuals.showActionBar) {
@@ -86,7 +86,7 @@ public abstract class MixinGui {
}
}
@Inject(method = "renderHotbarAndDecorations", at = @At("HEAD"), cancellable = true)
@Inject(method = "renderHotbarAndDecorations", at = @At("HEAD"), cancellable = true, require = 0)
public void renderHotbarAndDecorations(GuiGraphics guiGraphics, DeltaTracker deltaTracker, CallbackInfo ci) {
EditorState editorState = EditorStateManager.getCurrent();
if (editorState != null && !editorState.replayVisuals.showHotbar) {
@@ -94,7 +94,7 @@ public abstract class MixinGui {
}
}
@WrapOperation(method = "renderHotbarAndDecorations", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/multiplayer/MultiPlayerGameMode;getPlayerMode()Lnet/minecraft/world/level/GameType;"))
@WrapOperation(method = "renderHotbarAndDecorations", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/multiplayer/MultiPlayerGameMode;getPlayerMode()Lnet/minecraft/world/level/GameType;"), require = 0)
public GameType renderHotbarAndDecorations_getPlayerMode(MultiPlayerGameMode instance, Operation<GameType> original) {
if (Flashback.isInReplay()) {
return this.cameraGameType;
@@ -102,7 +102,7 @@ public abstract class MixinGui {
return original.call(instance);
}
@WrapOperation(method = "renderHotbarAndDecorations", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/multiplayer/MultiPlayerGameMode;canHurtPlayer()Z"))
@WrapOperation(method = "renderHotbarAndDecorations", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/multiplayer/MultiPlayerGameMode;canHurtPlayer()Z"), require = 0)
public boolean renderHotbarAndDecorations_canHurtPlayer(MultiPlayerGameMode instance, Operation<Boolean> original) {
if (Flashback.isInReplay()) {
return this.cameraGameType.isSurvival();
@@ -110,14 +110,14 @@ public abstract class MixinGui {
return original.call(instance);
}
@Inject(method = "isExperienceBarVisible", at = @At("HEAD"), cancellable = true)
@Inject(method = "isExperienceBarVisible", at = @At("HEAD"), cancellable = true, require = 0)
public void isExperienceBarVisible(CallbackInfoReturnable<Boolean> cir) {
if (Flashback.isInReplay()) {
cir.setReturnValue(this.cameraGameType.isSurvival());
}
}
@WrapOperation(method = "renderExperienceBar", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/player/LocalPlayer;getXpNeededForNextLevel()I"))
@WrapOperation(method = "renderExperienceBar", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/player/LocalPlayer;getXpNeededForNextLevel()I"), require = 0)
public int renderExperienceBar_getXpNeededForNextLevel(LocalPlayer instance, Operation<Integer> original) {
if (Flashback.isInReplay()) {
Player player = this.getCameraPlayer();
@@ -128,7 +128,7 @@ public abstract class MixinGui {
return original.call(instance);
}
@WrapOperation(method = "renderExperienceBar", at = @At(value = "FIELD", target = "Lnet/minecraft/client/player/LocalPlayer;experienceProgress:F"))
@WrapOperation(method = "renderExperienceBar", at = @At(value = "FIELD", target = "Lnet/minecraft/client/player/LocalPlayer;experienceProgress:F"), require = 0)
public float renderExperienceBar_experienceProgress(LocalPlayer instance, Operation<Float> original) {
if (Flashback.isInReplay()) {
Player player = this.getCameraPlayer();
@@ -139,7 +139,7 @@ public abstract class MixinGui {
return original.call(instance);
}
@WrapOperation(method = "renderCrosshair", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/player/LocalPlayer;getAttackStrengthScale(F)F"))
@WrapOperation(method = "renderCrosshair", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/player/LocalPlayer;getAttackStrengthScale(F)F"), require = 0)
public float renderCrosshair_getAttackStrengthScale(LocalPlayer instance, float partialTick, Operation<Float> original) {
if (Flashback.isInReplay()) {
Player player = this.getCameraPlayer();
@@ -150,7 +150,7 @@ public abstract class MixinGui {
return original.call(instance, partialTick);
}
@WrapOperation(method = "renderCrosshair", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/player/LocalPlayer;getCurrentItemAttackStrengthDelay()F"))
@WrapOperation(method = "renderCrosshair", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/player/LocalPlayer;getCurrentItemAttackStrengthDelay()F"), require = 0)
public float renderCrosshair_getCurrentItemAttackStrengthDelay(LocalPlayer instance, Operation<Float> original) {
if (Flashback.isInReplay()) {
Player player = this.getCameraPlayer();
@@ -161,7 +161,7 @@ public abstract class MixinGui {
return original.call(instance);
}
@WrapOperation(method = "renderExperienceLevel", at = @At(value = "FIELD", target = "Lnet/minecraft/client/player/LocalPlayer;experienceLevel:I"))
@WrapOperation(method = "renderExperienceLevel", at = @At(value = "FIELD", target = "Lnet/minecraft/client/player/LocalPlayer;experienceLevel:I"), require = 0)
public int renderExperienceLevel_experienceLevel(LocalPlayer instance, Operation<Integer> original) {
if (Flashback.isInReplay()) {
Player player = this.getCameraPlayer();
@@ -181,7 +181,7 @@ public abstract class MixinGui {
}
}
@Inject(method = "canRenderCrosshairForSpectator", at = @At("HEAD"), cancellable = true)
@Inject(method = "canRenderCrosshairForSpectator", at = @At("HEAD"), cancellable = true, require = 0)
public void canRenderCrosshairForSpectator(HitResult hitResult, CallbackInfoReturnable<Boolean> cir) {
if (Flashback.isInReplay()) {
if (!Flashback.isExporting() && ReplayUI.isActive() && ReplayUI.imguiGlfw.getMouseHandledBy() == CustomImGuiImplGlfw.MouseHandledBy.GAME) {
@@ -0,0 +1,28 @@
package com.moulberry.flashback.mixin.visuals;
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import com.moulberry.flashback.state.EditorState;
import com.moulberry.flashback.state.EditorStateManager;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.client.renderer.LightTexture;
import net.minecraft.core.Holder;
import net.minecraft.world.effect.MobEffects;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
@Mixin(LightTexture.class)
public class MixinLightTexture {
@WrapOperation(method = "updateLightTexture", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/player/LocalPlayer;hasEffect(Lnet/minecraft/core/Holder;)Z"), require = 0)
public boolean updateLightTexture_hasEffect(LocalPlayer instance, Holder holder, Operation<Boolean> original) {
if (holder == MobEffects.NIGHT_VISION) {
EditorState editorState = EditorStateManager.getCurrent();
if (editorState != null && editorState.replayVisuals.overrideNightVision) {
return true;
}
}
return original.call(instance, holder);
}
}
@@ -12,7 +12,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(LivingEntityRenderer.class)
public class MixinLivingEntityRenderer {
@Inject(method = "isBodyVisible", at = @At("HEAD"), cancellable = true)
@Inject(method = "isBodyVisible", at = @At("HEAD"), cancellable = true, require = 0)
public void isBodyVisible(LivingEntity livingEntity, CallbackInfoReturnable<Boolean> cir) {
EditorState editorState = EditorStateManager.getCurrent();
if (editorState != null && editorState.hideDuringExport.contains(livingEntity.getUUID())) {
@@ -19,7 +19,7 @@ public class MixinLoadingOverlay {
@Shadow @Final private Minecraft minecraft;
// Make overlay disappear instantly if inside replay
@Inject(method = "render", at = @At("RETURN"))
@Inject(method = "render", at = @At("RETURN"), require = 0)
public void render(GuiGraphics guiGraphics, int i, int j, float f, CallbackInfo ci) {
if (this.fadeOutStart != -1 && Flashback.isInReplay()) {
this.minecraft.setOverlay(null);
@@ -10,7 +10,7 @@ import org.spongepowered.asm.mixin.injection.At;
@Mixin(RenderStateShard.class)
public class MixinRenderStateShard {
@WrapOperation(method = "setupGlintTexturing", at = @At(value = "INVOKE", target = "Lnet/minecraft/Util;getMillis()J"))
@WrapOperation(method = "setupGlintTexturing", at = @At(value = "INVOKE", target = "Lnet/minecraft/Util;getMillis()J"), require = 0)
private static long setupGlintTexturing(Operation<Long> original) {
if (Flashback.isExporting()) {
double currentTick = Flashback.EXPORT_JOB.getCurrentTickDouble();