mirror of
https://github.com/darksaid98/Flashback.git
synced 2026-12-01 14:38:50 +00:00
Add Camera Shake Edit + option to not save voice chat
This commit is contained in:
1 parent
2fbe1f5480
commit
0c6ddc2427
7 files changed
+126
-16
No files matched your search
+4
@@ -58,6 +58,10 @@ public class SimpleVoiceChatRecorder {
|
||||
}
|
||||
|
||||
private static void submitSoundPacket(FlashbackVoiceChatSound soundPacket) {
|
||||
if (!Flashback.getConfig().recordVoiceChat) {
|
||||
return;
|
||||
}
|
||||
|
||||
Flashback.RECORDER.submitCustomTask(writer -> {
|
||||
writer.startAction(ActionSimpleVoiceChatSound.INSTANCE);
|
||||
FlashbackVoiceChatSound.STREAM_CODEC.encode(writer.friendlyByteBuf(), soundPacket);
|
||||
|
||||
@@ -55,9 +55,14 @@ public class FlashbackConfig {
|
||||
|
||||
@OptionCaption("flashback.option.local_player_updates_per_second")
|
||||
@OptionDescription("flashback.option.local_player_updates_per_second.description")
|
||||
@IntOptionRange(min = 20, max = 120, step = 20)
|
||||
@OptionIntRange(min = 20, max = 120, step = 20)
|
||||
public int localPlayerUpdatesPerSecond = 20;
|
||||
|
||||
@OptionCaption("flashback.option.record_voice_chat")
|
||||
@OptionDescription("flashback.option.record_voice_chat.description")
|
||||
@OptionIfModLoaded("voicechat")
|
||||
public boolean recordVoiceChat = false;
|
||||
|
||||
public Set<String> openedWindows = new HashSet<>();
|
||||
public long nextUnsupportedModLoaderWarning = 0;
|
||||
|
||||
@@ -77,6 +82,11 @@ public class FlashbackConfig {
|
||||
continue;
|
||||
}
|
||||
|
||||
OptionIfModLoaded ifModLoaded = field.getDeclaredAnnotation(OptionIfModLoaded.class);
|
||||
if (ifModLoaded != null && !FabricLoader.getInstance().isModLoaded(ifModLoaded.value())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
OptionInstance.TooltipSupplier tooltipSupplier = OptionInstance.noTooltip();
|
||||
OptionDescription description = field.getDeclaredAnnotation(OptionDescription.class);
|
||||
if (description != null) {
|
||||
@@ -97,7 +107,7 @@ public class FlashbackConfig {
|
||||
}
|
||||
}));
|
||||
} else if (field.getType() == int.class) {
|
||||
IntOptionRange range = field.getDeclaredAnnotation(IntOptionRange.class);
|
||||
OptionIntRange range = field.getDeclaredAnnotation(OptionIntRange.class);
|
||||
if (range == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.moulberry.flashback.configuration;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.FIELD)
|
||||
public @interface OptionIfModLoaded {
|
||||
|
||||
String value();
|
||||
|
||||
}
|
||||
+1
-1
@@ -7,7 +7,7 @@ import java.lang.annotation.Target;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.FIELD)
|
||||
public @interface IntOptionRange {
|
||||
public @interface OptionIntRange {
|
||||
|
||||
int min();
|
||||
int max();
|
||||
@@ -14,25 +14,31 @@ import com.moulberry.flashback.keyframe.handler.KeyframeHandler;
|
||||
import com.moulberry.flashback.keyframe.interpolation.InterpolationType;
|
||||
import com.moulberry.flashback.keyframe.types.CameraShakeKeyframeType;
|
||||
import com.moulberry.flashback.spline.CatmullRom;
|
||||
import com.moulberry.flashback.state.EditorState;
|
||||
import com.moulberry.flashback.state.EditorStateManager;
|
||||
import imgui.ImGui;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class CameraShakeKeyframe extends Keyframe {
|
||||
|
||||
private final float frequencyX;
|
||||
private final float amplitudeX;
|
||||
private final float frequencyY;
|
||||
private final float amplitudeY;
|
||||
private float frequencyX;
|
||||
private float amplitudeX;
|
||||
private float frequencyY;
|
||||
private float amplitudeY;
|
||||
private boolean splitParams;
|
||||
|
||||
public CameraShakeKeyframe(float frequencyX, float amplitudeX, float frequencyY, float amplitudeY) {
|
||||
this(frequencyX, amplitudeX, frequencyY, amplitudeY, InterpolationType.DEFAULT);
|
||||
public CameraShakeKeyframe(float frequencyX, float amplitudeX, float frequencyY, float amplitudeY, boolean splitParams) {
|
||||
this(frequencyX, amplitudeX, frequencyY, amplitudeY, splitParams, InterpolationType.DEFAULT);
|
||||
}
|
||||
|
||||
public CameraShakeKeyframe(float frequencyX, float amplitudeX, float frequencyY, float amplitudeY, InterpolationType interpolationType) {
|
||||
public CameraShakeKeyframe(float frequencyX, float amplitudeX, float frequencyY, float amplitudeY, boolean splitParams, InterpolationType interpolationType) {
|
||||
this.frequencyX = frequencyX;
|
||||
this.amplitudeX = amplitudeX;
|
||||
this.frequencyY = frequencyY;
|
||||
this.amplitudeY = amplitudeY;
|
||||
this.splitParams = splitParams;
|
||||
this.interpolationType(interpolationType);
|
||||
}
|
||||
|
||||
@@ -43,7 +49,77 @@ public class CameraShakeKeyframe extends Keyframe {
|
||||
|
||||
@Override
|
||||
public Keyframe copy() {
|
||||
return new CameraShakeKeyframe(this.frequencyX, this.amplitudeX, this.frequencyY, this.amplitudeY, this.interpolationType());
|
||||
return new CameraShakeKeyframe(this.frequencyX, this.amplitudeX, this.frequencyY, this.amplitudeY, this.splitParams, this.interpolationType());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderEditKeyframe(Consumer<Consumer<Keyframe>> update) {
|
||||
ImGui.setNextItemWidth(160);
|
||||
if (ImGui.checkbox("Split Y/X", this.splitParams)) {
|
||||
boolean splitParams = this.splitParams;
|
||||
update.accept(keyframe -> {
|
||||
CameraShakeKeyframe cameraShakeKeyframe = (CameraShakeKeyframe) keyframe;
|
||||
cameraShakeKeyframe.splitParams = !splitParams;
|
||||
cameraShakeKeyframe.frequencyY = cameraShakeKeyframe.frequencyX;
|
||||
cameraShakeKeyframe.amplitudeY = cameraShakeKeyframe.amplitudeX;
|
||||
});
|
||||
}
|
||||
|
||||
if (this.splitParams) {
|
||||
float[] input = new float[]{this.frequencyX};
|
||||
ImGui.setNextItemWidth(160);
|
||||
if (ImGui.sliderFloat("Frequency X", input, 0.1f, 10.0f, "%.1f") && input[0] != this.frequencyX) {
|
||||
update.accept(keyframe -> {
|
||||
((CameraShakeKeyframe)keyframe).splitParams = true;
|
||||
((CameraShakeKeyframe)keyframe).frequencyX = input[0];
|
||||
});
|
||||
}
|
||||
|
||||
input[0] = this.amplitudeX;
|
||||
ImGui.setNextItemWidth(160);
|
||||
if (ImGui.sliderFloat("Amplitude X", input, 0.0f, 10.0f, "%.1f") && input[0] != this.amplitudeX) {
|
||||
update.accept(keyframe -> {
|
||||
((CameraShakeKeyframe)keyframe).splitParams = true;
|
||||
((CameraShakeKeyframe)keyframe).amplitudeX = input[0];
|
||||
});
|
||||
}
|
||||
|
||||
input[0] = this.frequencyY;
|
||||
ImGui.setNextItemWidth(160);
|
||||
if (ImGui.sliderFloat("Frequency Y", input, 0.1f, 10.0f, "%.1f") && input[0] != this.frequencyY) {
|
||||
update.accept(keyframe -> {
|
||||
((CameraShakeKeyframe)keyframe).splitParams = true;
|
||||
((CameraShakeKeyframe)keyframe).frequencyY = input[0];
|
||||
});
|
||||
}
|
||||
|
||||
input[0] = this.amplitudeY;
|
||||
ImGui.setNextItemWidth(160);
|
||||
if (ImGui.sliderFloat("Amplitude Y", input, 0.0f, 10.0f, "%.1f") && input[0] != this.amplitudeY) {
|
||||
update.accept(keyframe -> {
|
||||
((CameraShakeKeyframe)keyframe).splitParams = true;
|
||||
((CameraShakeKeyframe)keyframe).amplitudeY = input[0];
|
||||
});
|
||||
}
|
||||
} else {
|
||||
float[] input = new float[]{this.frequencyX};
|
||||
ImGui.setNextItemWidth(160);
|
||||
if (ImGui.sliderFloat("Frequency", input, 0.1f, 10.0f, "%.1f") && input[0] != this.frequencyX) {
|
||||
update.accept(keyframe -> {
|
||||
((CameraShakeKeyframe)keyframe).frequencyX = input[0];
|
||||
((CameraShakeKeyframe)keyframe).frequencyY = input[0];
|
||||
});
|
||||
}
|
||||
|
||||
input[0] = this.amplitudeX;
|
||||
ImGui.setNextItemWidth(160);
|
||||
if (ImGui.sliderFloat("Amplitude", input, 0.0f, 10.0f, "%.1f") && input[0] != this.amplitudeX) {
|
||||
update.accept(keyframe -> {
|
||||
((CameraShakeKeyframe)keyframe).amplitudeX = input[0];
|
||||
((CameraShakeKeyframe)keyframe).amplitudeY = input[0];
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -111,8 +187,9 @@ public class CameraShakeKeyframe extends Keyframe {
|
||||
float amplitudeX = jsonObject.get("amplitudeX").getAsFloat();
|
||||
float frequencyY = jsonObject.get("frequencyY").getAsFloat();
|
||||
float amplitudeY = jsonObject.get("amplitudeY").getAsFloat();
|
||||
boolean splitParams = jsonObject.has("splitParams") && jsonObject.get("splitParams").getAsBoolean();
|
||||
InterpolationType interpolationType = context.deserialize(jsonObject.get("interpolation_type"), InterpolationType.class);
|
||||
return new CameraShakeKeyframe(frequencyX, amplitudeX, frequencyY, amplitudeY, interpolationType);
|
||||
return new CameraShakeKeyframe(frequencyX, amplitudeX, frequencyY, amplitudeY, splitParams, interpolationType);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -122,6 +199,9 @@ public class CameraShakeKeyframe extends Keyframe {
|
||||
jsonObject.addProperty("amplitudeX", src.amplitudeX);
|
||||
jsonObject.addProperty("frequencyY", src.frequencyY);
|
||||
jsonObject.addProperty("amplitudeY", src.amplitudeY);
|
||||
if (src.splitParams) {
|
||||
jsonObject.addProperty("splitParams", true);
|
||||
}
|
||||
jsonObject.addProperty("type", "camera_shake");
|
||||
jsonObject.add("interpolation_type", context.serialize(src.interpolationType()));
|
||||
return jsonObject;
|
||||
|
||||
@@ -71,10 +71,10 @@ public class CameraShakeKeyframeType implements KeyframeType<CameraShakeKeyframe
|
||||
if (ImGui.button("Add")) {
|
||||
if (cameraShakeSplitXYKeyframeInput[0]) {
|
||||
return new CameraShakeKeyframe(cameraShakeFrequencyXKeyframeInput[0], cameraShakeAmplitudeXKeyframeInput[0],
|
||||
cameraShakeFrequencyYKeyframeInput[0], cameraShakeAmplitudeYKeyframeInput[0]);
|
||||
cameraShakeFrequencyYKeyframeInput[0], cameraShakeAmplitudeYKeyframeInput[0], true);
|
||||
} else {
|
||||
return new CameraShakeKeyframe(cameraShakeFrequencyXKeyframeInput[0], cameraShakeAmplitudeXKeyframeInput[0],
|
||||
cameraShakeFrequencyXKeyframeInput[0], cameraShakeAmplitudeXKeyframeInput[0]);
|
||||
cameraShakeFrequencyXKeyframeInput[0], cameraShakeAmplitudeXKeyframeInput[0], false);
|
||||
}
|
||||
}
|
||||
ImGui.sameLine();
|
||||
|
||||
@@ -22,7 +22,9 @@
|
||||
"flashback.option.mark_dimension_changes": "Mark Dimension Changes",
|
||||
"flashback.option.mark_dimension_changes.description": "Automatically add a marker to the replay when switching dimensions",
|
||||
"flashback.option.record_hotbar": "Record Hotbar",
|
||||
"flashback.option.record_hotbar.description": "Adds first-person hotbar information to recorded replays",
|
||||
"flashback.option.record_hotbar.description": "Adds first-person hotbar information into the replay",
|
||||
"flashback.option.local_player_updates_per_second": "First-person Updates",
|
||||
"flashback.option.local_player_updates_per_second.description": "The update rate per second for the position/angle of the first-person player"
|
||||
"flashback.option.local_player_updates_per_second.description": "The update rate per second for the position/angle of the first-person player",
|
||||
"flashback.option.record_voice_chat": "Record Voice Chat",
|
||||
"flashback.option.record_voice_chat.description": "Adds voice chat from SimpleVoiceChat into the replay"
|
||||
}
|
||||
Reference in new issue
Block a user