mirror of
https://github.com/darksaid98/Flashback.git
synced 2026-12-02 06:28:48 +00:00
Stuff
This commit is contained in:
1 parent
9c4a30d224
commit
666398e480
174 files changed
+8694
-2942
No files matched your search
@@ -0,0 +1,21 @@
|
||||
package com.moulberry.flashback.mixin.visuals;
|
||||
|
||||
import com.moulberry.flashback.ReplayVisuals;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.client.gui.components.BossHealthOverlay;
|
||||
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(BossHealthOverlay.class)
|
||||
public class MixinBossHealthOverlay {
|
||||
|
||||
@Inject(method = "render", at = @At("HEAD"), cancellable = true)
|
||||
public void render(GuiGraphics guiGraphics, CallbackInfo ci) {
|
||||
if (!ReplayVisuals.showBossBar) {
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.moulberry.flashback.mixin.visuals;
|
||||
|
||||
public class MixinClientLevel {
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.moulberry.flashback.mixin.visuals;
|
||||
|
||||
import com.moulberry.flashback.ReplayVisuals;
|
||||
import net.minecraft.client.multiplayer.ClientLevel;
|
||||
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.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(ClientLevel.ClientLevelData.class)
|
||||
public class MixinClientLevelData {
|
||||
|
||||
@Inject(method = "getDayTime", at = @At("HEAD"), cancellable = true)
|
||||
public void getDayTime(CallbackInfoReturnable<Long> cir) {
|
||||
if (ReplayVisuals.overrideTimeOfDay >= 0) {
|
||||
cir.setReturnValue(ReplayVisuals.overrideTimeOfDay);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.moulberry.flashback.mixin.visuals;
|
||||
|
||||
import com.llamalad7.mixinextras.injector.v2.WrapWithCondition;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import com.moulberry.flashback.ReplayVisuals;
|
||||
import com.moulberry.flashback.editor.ui.ReplayUI;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.entity.EntityRenderDispatcher;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.level.LevelReader;
|
||||
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;
|
||||
|
||||
@Mixin(value = EntityRenderDispatcher.class, priority = 990)
|
||||
public abstract class MixinEntityRenderDispatcher {
|
||||
|
||||
@Shadow
|
||||
private static void renderHitbox(PoseStack poseStack, VertexConsumer vertexConsumer, Entity entity, float f, float g, float h, float i) {
|
||||
}
|
||||
|
||||
// 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))
|
||||
public void render(Entity entity, double d, double e, double f, float g, float h, PoseStack poseStack, MultiBufferSource multiBufferSource, int i, CallbackInfo ci) {
|
||||
if (ReplayUI.isEntitySelected(entity.getId())) {
|
||||
renderHitbox(poseStack, multiBufferSource.getBuffer(RenderType.lines()), entity, h, 1.0f, 1.0f, 0.0f);
|
||||
}
|
||||
}
|
||||
|
||||
// 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"))
|
||||
public boolean renderShadow(PoseStack poseStack, MultiBufferSource multiBufferSource, Entity entity, float f, float g, LevelReader levelReader, float h) {
|
||||
return ReplayVisuals.renderBlocks;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.moulberry.flashback.mixin.visuals;
|
||||
|
||||
import com.mojang.blaze3d.shaders.FogShape;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.moulberry.flashback.ReplayVisuals;
|
||||
import net.minecraft.client.Camera;
|
||||
import net.minecraft.client.renderer.FogRenderer;
|
||||
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(FogRenderer.class)
|
||||
public class MixinFogRenderer {
|
||||
|
||||
@Inject(method = "setupFog", at = @At("HEAD"), cancellable = true)
|
||||
private static void setupFog(Camera camera, FogRenderer.FogMode fogMode, float f, boolean bl, float g, CallbackInfo ci) {
|
||||
if (ReplayVisuals.overrideFog) {
|
||||
RenderSystem.setShaderFogStart(ReplayVisuals.overrideFogStart);
|
||||
RenderSystem.setShaderFogEnd(ReplayVisuals.overrideFogEnd);
|
||||
RenderSystem.setShaderFogShape(FogShape.SPHERE);
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.moulberry.flashback.mixin.visuals;
|
||||
|
||||
import com.moulberry.flashback.ReplayVisuals;
|
||||
import com.moulberry.flashback.editor.ui.CustomImGuiImplGlfw;
|
||||
import com.moulberry.flashback.editor.ui.ReplayUI;
|
||||
import net.minecraft.client.DeltaTracker;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.world.phys.HitResult;
|
||||
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 org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(Gui.class)
|
||||
public class MixinGui {
|
||||
|
||||
@Inject(method = "renderChat", at = @At("HEAD"), cancellable = true)
|
||||
public void renderChat(GuiGraphics guiGraphics, DeltaTracker deltaTracker, CallbackInfo ci) {
|
||||
if (!ReplayVisuals.showChat) {
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "renderTitle", at = @At("HEAD"), cancellable = true)
|
||||
public void renderTitle(GuiGraphics guiGraphics, DeltaTracker deltaTracker, CallbackInfo ci) {
|
||||
if (!ReplayVisuals.showTitleText) {
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "renderScoreboardSidebar", at = @At("HEAD"), cancellable = true)
|
||||
public void renderScoreboardSidebar(GuiGraphics guiGraphics, DeltaTracker deltaTracker, CallbackInfo ci) {
|
||||
if (!ReplayVisuals.showScoreboard) {
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "renderOverlayMessage", at = @At("HEAD"), cancellable = true)
|
||||
public void renderOverlayMessage(GuiGraphics guiGraphics, DeltaTracker deltaTracker, CallbackInfo ci) {
|
||||
if (!ReplayVisuals.showActionBar) {
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "canRenderCrosshairForSpectator", at = @At("HEAD"), cancellable = true)
|
||||
public void canRenderCrosshairForSpectator(HitResult hitResult, CallbackInfoReturnable<Boolean> cir) {
|
||||
if (ReplayUI.isActive() && ReplayUI.imguiGlfw.getMouseHandledBy() == CustomImGuiImplGlfw.MouseHandledBy.GAME) {
|
||||
cir.setReturnValue(true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.moulberry.flashback.mixin.visuals;
|
||||
|
||||
import com.moulberry.flashback.Flashback;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraft.client.gui.screens.LoadingOverlay;
|
||||
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;
|
||||
|
||||
@Mixin(LoadingOverlay.class)
|
||||
public class MixinLoadingOverlay {
|
||||
|
||||
@Shadow private long fadeOutStart;
|
||||
|
||||
@Shadow @Final private Minecraft minecraft;
|
||||
|
||||
// Make overlay disappear instantly if inside replay
|
||||
@Inject(method = "render", at = @At("RETURN"))
|
||||
public void render(GuiGraphics guiGraphics, int i, int j, float f, CallbackInfo ci) {
|
||||
if (this.fadeOutStart != -1 && Flashback.isInReplay()) {
|
||||
this.minecraft.setOverlay(null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.moulberry.flashback.mixin.visuals;
|
||||
|
||||
import com.moulberry.flashback.ReplayVisuals;
|
||||
import net.minecraft.client.OptionInstance;
|
||||
import net.minecraft.client.Options;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(Options.class)
|
||||
public class MixinOptions {
|
||||
|
||||
@Unique
|
||||
private OptionInstance<Integer> cachedOptionInstance = null;
|
||||
|
||||
@Inject(method = "fov", at = @At("RETURN"), cancellable = true)
|
||||
public void fov(CallbackInfoReturnable<OptionInstance<Integer>> cir) {
|
||||
if (ReplayVisuals.overrideFov) {
|
||||
if (this.cachedOptionInstance == null || this.cachedOptionInstance.get() != Math.round(ReplayVisuals.overrideFovAmount)) {
|
||||
OptionInstance<Integer> delegate = cir.getReturnValue();
|
||||
this.cachedOptionInstance = new OptionInstance<>("options.fov", OptionInstance.noTooltip(), Options::genericValueLabel,
|
||||
delegate.values(), delegate.codec(), Math.round(ReplayVisuals.overrideFovAmount), value -> {
|
||||
ReplayVisuals.overrideFov = false;
|
||||
delegate.set(value);
|
||||
});
|
||||
}
|
||||
|
||||
cir.setReturnValue(this.cachedOptionInstance);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user