mirror of
https://github.com/darksaid98/Flashback.git
synced 2026-12-03 14:38:50 +00:00
Add Render Filter window
This commit is contained in:
1 parent
f783b57ee2
commit
e93b1fd879
11 files changed
+314
-11
No files matched your search
@@ -109,6 +109,8 @@ public class FlashbackConfig {
|
|||||||
|
|
||||||
private transient int saveDelay = 0;
|
private transient int saveDelay = 0;
|
||||||
|
|
||||||
|
public boolean signedRenderFilter = false;
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public OptionInstance<?>[] createOptionInstances() {
|
public OptionInstance<?>[] createOptionInstances() {
|
||||||
List<OptionInstance<?>> options = new ArrayList<>();
|
List<OptionInstance<?>> options = new ArrayList<>();
|
||||||
|
|||||||
@@ -267,6 +267,7 @@ public class ReplayUI {
|
|||||||
builder.addChar('\ue40a');
|
builder.addChar('\ue40a');
|
||||||
builder.addChar('\ue92b');
|
builder.addChar('\ue92b');
|
||||||
builder.addChar('\ueb3b');
|
builder.addChar('\ueb3b');
|
||||||
|
builder.addChar('\ue14a');
|
||||||
return builder.buildRanges();
|
return builder.buildRanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -88,6 +88,9 @@ public class MainMenuBar {
|
|||||||
if (ImGui.menuItem("Movement")) {
|
if (ImGui.menuItem("Movement")) {
|
||||||
toggleWindow("movement");
|
toggleWindow("movement");
|
||||||
}
|
}
|
||||||
|
if (ImGui.menuItem("Render Filter")) {
|
||||||
|
toggleWindow("render_filter");
|
||||||
|
}
|
||||||
|
|
||||||
ImGui.separator();
|
ImGui.separator();
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,8 @@ import com.moulberry.flashback.keyframe.interpolation.InterpolationType;
|
|||||||
import com.moulberry.flashback.state.EditorState;
|
import com.moulberry.flashback.state.EditorState;
|
||||||
import com.moulberry.flashback.state.EditorStateManager;
|
import com.moulberry.flashback.state.EditorStateManager;
|
||||||
import imgui.ImGui;
|
import imgui.ImGui;
|
||||||
|
import imgui.ImVec2;
|
||||||
|
import imgui.flag.ImGuiCond;
|
||||||
import imgui.flag.ImGuiWindowFlags;
|
import imgui.flag.ImGuiWindowFlags;
|
||||||
import imgui.type.ImShort;
|
import imgui.type.ImShort;
|
||||||
import imgui.type.ImString;
|
import imgui.type.ImString;
|
||||||
@@ -32,7 +34,10 @@ public class PreferencesWindow {
|
|||||||
|
|
||||||
boolean wasOpen = ImGui.isPopupOpen("###Preferences");
|
boolean wasOpen = ImGui.isPopupOpen("###Preferences");
|
||||||
|
|
||||||
if (ImGuiHelper.beginPopupModalCloseable("Preferences###Preferences", ImGuiWindowFlags.AlwaysAutoResize)) {
|
ImVec2 center = ImGui.getMainViewport().getCenter();
|
||||||
|
ImGui.setNextWindowPos(center.x, center.y, ImGuiCond.Appearing, 0.5f, 0.5f);
|
||||||
|
ImGui.setNextWindowSize(400, 0);
|
||||||
|
if (ImGuiHelper.beginPopupModalCloseable("Preferences###Preferences", ImGuiWindowFlags.NoResize)) {
|
||||||
if (close) {
|
if (close) {
|
||||||
close = false;
|
close = false;
|
||||||
ImGui.closeCurrentPopup();
|
ImGui.closeCurrentPopup();
|
||||||
@@ -46,6 +51,7 @@ public class PreferencesWindow {
|
|||||||
ImGuiHelper.separatorWithText("Exporting");
|
ImGuiHelper.separatorWithText("Exporting");
|
||||||
|
|
||||||
ImString imString = ImGuiHelper.createResizableImString(config.defaultExportFilename);
|
ImString imString = ImGuiHelper.createResizableImString(config.defaultExportFilename);
|
||||||
|
ImGui.setNextItemWidth(200);
|
||||||
if (ImGui.inputText("Export Filename", imString)) {
|
if (ImGui.inputText("Export Filename", imString)) {
|
||||||
config.defaultExportFilename = ImGuiHelper.getString(imString);
|
config.defaultExportFilename = ImGuiHelper.getString(imString);
|
||||||
config.delayedSaveToDefaultFolder();
|
config.delayedSaveToDefaultFolder();
|
||||||
@@ -55,13 +61,11 @@ public class PreferencesWindow {
|
|||||||
// Keyframes
|
// Keyframes
|
||||||
ImGuiHelper.separatorWithText("Keyframes");
|
ImGuiHelper.separatorWithText("Keyframes");
|
||||||
|
|
||||||
|
ImGui.setNextItemWidth(200);
|
||||||
config.defaultInterpolationType = ImGuiHelper.enumCombo("Default Interpolation", config.defaultInterpolationType);
|
config.defaultInterpolationType = ImGuiHelper.enumCombo("Default Interpolation", config.defaultInterpolationType);
|
||||||
|
|
||||||
ImGuiHelper.endPopupModalCloseable();
|
|
||||||
|
|
||||||
if (ImGui.collapsingHeader("Advanced")) {
|
if (ImGui.collapsingHeader("Advanced")) {
|
||||||
ImGui.textWrapped("Don't change any of these unless you know what you're doing");
|
ImGui.textWrapped("Don't change any of these unless you know what you're doing!! If you change one of these and then ask for support you will be made fun of!!");
|
||||||
ImGui.textWrapped("If you change one of these and then ask for support you will be made fun of");
|
|
||||||
if (ImGui.checkbox("Disable increased first-person updates", config.disableIncreasedFirstPersonUpdates)) {
|
if (ImGui.checkbox("Disable increased first-person updates", config.disableIncreasedFirstPersonUpdates)) {
|
||||||
config.disableIncreasedFirstPersonUpdates = !config.disableIncreasedFirstPersonUpdates;
|
config.disableIncreasedFirstPersonUpdates = !config.disableIncreasedFirstPersonUpdates;
|
||||||
config.delayedSaveToDefaultFolder();
|
config.delayedSaveToDefaultFolder();
|
||||||
@@ -71,6 +75,8 @@ public class PreferencesWindow {
|
|||||||
config.delayedSaveToDefaultFolder();
|
config.delayedSaveToDefaultFolder();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImGuiHelper.endPopupModalCloseable();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wasOpen && !ImGui.isPopupOpen("###Preferences")) {
|
if (wasOpen && !ImGui.isPopupOpen("###Preferences")) {
|
||||||
|
|||||||
@@ -0,0 +1,225 @@
|
|||||||
|
package com.moulberry.flashback.editor.ui.windows;
|
||||||
|
|
||||||
|
import com.moulberry.flashback.Flashback;
|
||||||
|
import com.moulberry.flashback.configuration.FlashbackConfig;
|
||||||
|
import com.moulberry.flashback.editor.ui.ImGuiHelper;
|
||||||
|
import com.moulberry.flashback.state.EditorState;
|
||||||
|
import com.moulberry.flashback.state.EditorStateManager;
|
||||||
|
import imgui.ImGui;
|
||||||
|
import imgui.ImGuiListClipper;
|
||||||
|
import imgui.ImGuiViewport;
|
||||||
|
import imgui.callback.ImListClipperCallback;
|
||||||
|
import imgui.flag.ImGuiCond;
|
||||||
|
import imgui.flag.ImGuiWindowFlags;
|
||||||
|
import imgui.type.ImBoolean;
|
||||||
|
import imgui.type.ImString;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.resources.language.I18n;
|
||||||
|
import net.minecraft.core.particles.ParticleType;
|
||||||
|
import net.minecraft.core.registries.BuiltInRegistries;
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.world.entity.EntityType;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
public class RenderFilterWindow {
|
||||||
|
|
||||||
|
private static boolean wasDocked = false;
|
||||||
|
|
||||||
|
private static ImString entitySearch = ImGuiHelper.createResizableImString("");
|
||||||
|
private static String lastEntitySearch = null;
|
||||||
|
private static List<EntityType<?>> searchedEntityTypes = new ArrayList<>();
|
||||||
|
|
||||||
|
private static ImString particleSearch = ImGuiHelper.createResizableImString("");
|
||||||
|
private static String lastParticleSearch = null;
|
||||||
|
private static List<ResourceLocation> searchedParticleTypes = new ArrayList<>();
|
||||||
|
|
||||||
|
public static void render(ImBoolean open, boolean newlyOpened) {
|
||||||
|
if (newlyOpened) {
|
||||||
|
ImGuiViewport viewport = ImGui.getMainViewport();
|
||||||
|
ImGui.setNextWindowPos(viewport.getCenterX(), viewport.getCenterY(), ImGuiCond.Appearing, 0.5f, 0.5f);
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui.setNextWindowSizeConstraints(250, 50, 5000, 5000);
|
||||||
|
int flags = ImGuiWindowFlags.NoFocusOnAppearing;
|
||||||
|
if (!wasDocked) {
|
||||||
|
flags |= ImGuiWindowFlags.AlwaysAutoResize;
|
||||||
|
}
|
||||||
|
if (ImGui.begin("Render Filter###Render Filter", open, flags)) {
|
||||||
|
wasDocked = ImGui.isWindowDocked();
|
||||||
|
|
||||||
|
FlashbackConfig config = Flashback.getConfig();
|
||||||
|
|
||||||
|
if (!config.signedRenderFilter) {
|
||||||
|
String name = Minecraft.getInstance().getGameProfile().getName();
|
||||||
|
ImGui.pushTextWrapPos(300);
|
||||||
|
ImGui.textWrapped("I, " + name + ", do solemnly swear that I will not toggle something off in the 'Render Filter' menu and then later ask in Flashback support why the entity is not being rendered.");
|
||||||
|
if (ImGui.checkbox("Signed, " + name + ".", false)) {
|
||||||
|
config.signedRenderFilter = true;
|
||||||
|
config.delayedSaveToDefaultFolder();
|
||||||
|
}
|
||||||
|
ImGui.popTextWrapPos();
|
||||||
|
ImGui.end();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
EditorState editorState = EditorStateManager.getCurrent();
|
||||||
|
|
||||||
|
if (editorState == null) {
|
||||||
|
ImGui.end();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ImGui.beginTabBar("##Select")) {
|
||||||
|
if (ImGui.beginTabItem("Entities")) {
|
||||||
|
ImGui.inputText("Search", entitySearch);
|
||||||
|
String searchString = ImGuiHelper.getString(entitySearch).trim().toLowerCase(Locale.ROOT);
|
||||||
|
if (!searchString.equals(lastEntitySearch)) {
|
||||||
|
lastEntitySearch = searchString;
|
||||||
|
searchedEntityTypes = new ArrayList<>();
|
||||||
|
|
||||||
|
List<EntityType<?>> contains = new ArrayList<>();
|
||||||
|
|
||||||
|
for (EntityType<?> entityType : BuiltInRegistries.ENTITY_TYPE) {
|
||||||
|
String name = I18n.get(entityType.getDescriptionId()).trim().toLowerCase(Locale.ROOT);
|
||||||
|
if (name.startsWith(lastEntitySearch)) {
|
||||||
|
searchedEntityTypes.add(entityType);
|
||||||
|
} else if (name.contains(lastEntitySearch)) {
|
||||||
|
contains.add(entityType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
searchedEntityTypes.addAll(contains);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (searchedEntityTypes.isEmpty()) {
|
||||||
|
ImGui.text("No entities found");
|
||||||
|
} else {
|
||||||
|
if (ImGui.beginChild("##Scroller", 0, 300)) {
|
||||||
|
ImGuiListClipper.forEach(searchedEntityTypes.size(), new ImListClipperCallback() {
|
||||||
|
@Override
|
||||||
|
public void accept(int i) {
|
||||||
|
EntityType<?> entityType = searchedEntityTypes.get(i);
|
||||||
|
ResourceLocation resourceLocation = BuiltInRegistries.ENTITY_TYPE.getKey(entityType);
|
||||||
|
|
||||||
|
boolean filtered = editorState.filteredEntities.contains(resourceLocation.toString());
|
||||||
|
|
||||||
|
String name = I18n.get(entityType.getDescriptionId());
|
||||||
|
if (ImGui.checkbox(name + "###" + resourceLocation, !filtered)) {
|
||||||
|
if (filtered) {
|
||||||
|
editorState.filteredEntities.remove(resourceLocation.toString());
|
||||||
|
} else {
|
||||||
|
editorState.filteredEntities.add(resourceLocation.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
ImGui.endChild();
|
||||||
|
|
||||||
|
if (ImGui.smallButton("Enable All")) {
|
||||||
|
editorState.filteredEntities.clear();
|
||||||
|
}
|
||||||
|
ImGui.sameLine();
|
||||||
|
if (ImGui.smallButton("Disable All")) {
|
||||||
|
for (EntityType<?> entityType : BuiltInRegistries.ENTITY_TYPE) {
|
||||||
|
ResourceLocation resourceLocation = BuiltInRegistries.ENTITY_TYPE.getKey(entityType);
|
||||||
|
editorState.filteredEntities.add(resourceLocation.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui.endTabItem();
|
||||||
|
}
|
||||||
|
if (ImGui.beginTabItem("Particles")) {
|
||||||
|
ImGui.inputText("Search", particleSearch);
|
||||||
|
String searchString = ImGuiHelper.getString(particleSearch).trim().toLowerCase(Locale.ROOT);
|
||||||
|
if (!searchString.equals(lastParticleSearch)) {
|
||||||
|
lastParticleSearch = searchString;
|
||||||
|
searchedParticleTypes = new ArrayList<>();
|
||||||
|
|
||||||
|
List<ResourceLocation> contains = new ArrayList<>();
|
||||||
|
|
||||||
|
for (ParticleType<?> particleType : BuiltInRegistries.PARTICLE_TYPE) {
|
||||||
|
ResourceLocation resourceLocation = BuiltInRegistries.PARTICLE_TYPE.getKey(particleType);
|
||||||
|
if (resourceLocation == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
String name;
|
||||||
|
if (resourceLocation.getNamespace().equals("minecraft")) {
|
||||||
|
name = resourceLocation.getPath().toLowerCase(Locale.ROOT);
|
||||||
|
} else {
|
||||||
|
name = resourceLocation.toString().toLowerCase(Locale.ROOT);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name.startsWith(lastParticleSearch)) {
|
||||||
|
searchedParticleTypes.add(resourceLocation);
|
||||||
|
} else if (name.contains(lastParticleSearch)) {
|
||||||
|
contains.add(resourceLocation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
searchedParticleTypes.addAll(contains);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (searchedParticleTypes.isEmpty()) {
|
||||||
|
ImGui.text("No particles found");
|
||||||
|
} else {
|
||||||
|
if (ImGui.beginChild("##Scroller", 0, 300)) {
|
||||||
|
ImGuiListClipper.forEach(searchedParticleTypes.size(), new ImListClipperCallback() {
|
||||||
|
@Override
|
||||||
|
public void accept(int i) {
|
||||||
|
ResourceLocation particleType = searchedParticleTypes.get(i);
|
||||||
|
|
||||||
|
boolean filtered = editorState.filteredParticles.contains(particleType.toString());
|
||||||
|
|
||||||
|
String name;
|
||||||
|
if (particleType.getNamespace().equals("minecraft")) {
|
||||||
|
name = particleType.getPath().toLowerCase(Locale.ROOT);
|
||||||
|
} else {
|
||||||
|
name = particleType.toString().toLowerCase(Locale.ROOT);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ImGui.checkbox(name, !filtered)) {
|
||||||
|
if (filtered) {
|
||||||
|
editorState.filteredParticles.remove(particleType.toString());
|
||||||
|
} else {
|
||||||
|
editorState.filteredParticles.add(particleType.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
ImGui.endChild();
|
||||||
|
|
||||||
|
if (ImGui.smallButton("Enable All")) {
|
||||||
|
editorState.filteredParticles.clear();
|
||||||
|
}
|
||||||
|
ImGui.sameLine();
|
||||||
|
if (ImGui.smallButton("Disable All")) {
|
||||||
|
for (ParticleType<?> particleType : BuiltInRegistries.PARTICLE_TYPE) {
|
||||||
|
ResourceLocation resourceLocation = BuiltInRegistries.PARTICLE_TYPE.getKey(particleType);
|
||||||
|
if (resourceLocation == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
editorState.filteredParticles.add(resourceLocation.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui.pushTextWrapPos(300);
|
||||||
|
ImGui.textWrapped("Note: Due to technical limitations, will only prevent new particles from spawning. Existing particles won't be affected.");
|
||||||
|
ImGui.popTextWrapPos();
|
||||||
|
|
||||||
|
ImGui.endTabItem();
|
||||||
|
}
|
||||||
|
ImGui.endTabBar();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ImGui.end();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1578,6 +1578,7 @@ public class TimelineWindow {
|
|||||||
ImGui.setCursorScreenPos(x + 8, y + 6);
|
ImGui.setCursorScreenPos(x + 8, y + 6);
|
||||||
float lineHeight = ImGui.getTextLineHeightWithSpacing() + ImGui.getStyle().getItemSpacingY();
|
float lineHeight = ImGui.getTextLineHeightWithSpacing() + ImGui.getStyle().getItemSpacingY();
|
||||||
|
|
||||||
|
int keyframeTrackToDelete = -1;
|
||||||
int keyframeTrackToClear = -1;
|
int keyframeTrackToClear = -1;
|
||||||
|
|
||||||
ImDrawList drawList = ImGui.getWindowDrawList();
|
ImDrawList drawList = ImGui.getWindowDrawList();
|
||||||
@@ -1766,6 +1767,9 @@ public class TimelineWindow {
|
|||||||
openTrackColourPopup = true;
|
openTrackColourPopup = true;
|
||||||
}
|
}
|
||||||
if (ImGui.menuItem("\ue872 Delete track")) {
|
if (ImGui.menuItem("\ue872 Delete track")) {
|
||||||
|
keyframeTrackToDelete = trackIndex;
|
||||||
|
}
|
||||||
|
if (ImGui.menuItem("\ue14a Clear Keyframes")) {
|
||||||
keyframeTrackToClear = trackIndex;
|
keyframeTrackToClear = trackIndex;
|
||||||
}
|
}
|
||||||
ImGui.endPopup();
|
ImGui.endPopup();
|
||||||
@@ -1806,20 +1810,34 @@ public class TimelineWindow {
|
|||||||
}
|
}
|
||||||
openCreateKeyframeAtTickTrack = -1;
|
openCreateKeyframeAtTickTrack = -1;
|
||||||
|
|
||||||
if (keyframeTrackToClear >= 0) {
|
if (keyframeTrackToDelete >= 0) {
|
||||||
|
List<EditorSceneHistoryAction> undo = new ArrayList<>();
|
||||||
|
List<EditorSceneHistoryAction> redo = new ArrayList<>();
|
||||||
|
|
||||||
|
KeyframeTrack keyframeTrack = editorScene.keyframeTracks.get(keyframeTrackToDelete);
|
||||||
|
|
||||||
|
undo.add(new EditorSceneHistoryAction.AddTrack(keyframeTrack.keyframeType, keyframeTrackToDelete));
|
||||||
|
for (Map.Entry<Integer, Keyframe> entry : keyframeTrack.keyframesByTick.entrySet()) {
|
||||||
|
undo.add(new EditorSceneHistoryAction.SetKeyframe(keyframeTrack.keyframeType, keyframeTrackToDelete, entry.getKey(), entry.getValue().copy()));
|
||||||
|
}
|
||||||
|
|
||||||
|
redo.add(new EditorSceneHistoryAction.RemoveTrack(keyframeTrack.keyframeType, keyframeTrackToDelete));
|
||||||
|
|
||||||
|
editorScene.push(new EditorSceneHistoryEntry(undo, redo, "Delete " + keyframeTrack.keyframeType.name() + " track"));
|
||||||
|
editorState.markDirty();
|
||||||
|
selectedKeyframesList.clear();
|
||||||
|
} else if (keyframeTrackToClear >= 0) {
|
||||||
List<EditorSceneHistoryAction> undo = new ArrayList<>();
|
List<EditorSceneHistoryAction> undo = new ArrayList<>();
|
||||||
List<EditorSceneHistoryAction> redo = new ArrayList<>();
|
List<EditorSceneHistoryAction> redo = new ArrayList<>();
|
||||||
|
|
||||||
KeyframeTrack keyframeTrack = editorScene.keyframeTracks.get(keyframeTrackToClear);
|
KeyframeTrack keyframeTrack = editorScene.keyframeTracks.get(keyframeTrackToClear);
|
||||||
|
|
||||||
undo.add(new EditorSceneHistoryAction.AddTrack(keyframeTrack.keyframeType, keyframeTrackToClear));
|
|
||||||
for (Map.Entry<Integer, Keyframe> entry : keyframeTrack.keyframesByTick.entrySet()) {
|
for (Map.Entry<Integer, Keyframe> entry : keyframeTrack.keyframesByTick.entrySet()) {
|
||||||
undo.add(new EditorSceneHistoryAction.SetKeyframe(keyframeTrack.keyframeType, keyframeTrackToClear, entry.getKey(), entry.getValue().copy()));
|
undo.add(new EditorSceneHistoryAction.SetKeyframe(keyframeTrack.keyframeType, keyframeTrackToClear, entry.getKey(), entry.getValue().copy()));
|
||||||
|
redo.add(new EditorSceneHistoryAction.RemoveKeyframe(keyframeTrack.keyframeType, keyframeTrackToClear, entry.getKey()));
|
||||||
}
|
}
|
||||||
|
|
||||||
redo.add(new EditorSceneHistoryAction.RemoveTrack(keyframeTrack.keyframeType, keyframeTrackToClear));
|
editorScene.push(new EditorSceneHistoryEntry(undo, redo, "Clear " + keyframeTrack.keyframeType.name() + " track"));
|
||||||
|
|
||||||
editorScene.push(new EditorSceneHistoryEntry(undo, redo, "Delete " + keyframeTrack.keyframeType.name() + " track"));
|
|
||||||
editorState.markDirty();
|
editorState.markDirty();
|
||||||
selectedKeyframesList.clear();
|
selectedKeyframesList.clear();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,8 @@ import java.util.Set;
|
|||||||
public enum WindowType {
|
public enum WindowType {
|
||||||
|
|
||||||
PLAYER_LIST("player_list", PlayerListWindow::render),
|
PLAYER_LIST("player_list", PlayerListWindow::render),
|
||||||
MOVEMENT("movement", MovementWindow::render);
|
MOVEMENT("movement", MovementWindow::render),
|
||||||
|
RENDER_FILTER("render_filter", RenderFilterWindow::render);
|
||||||
|
|
||||||
private final String windowId;
|
private final String windowId;
|
||||||
private final ImGuiWindowRenderer renderMethod;
|
private final ImGuiWindowRenderer renderMethod;
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import com.moulberry.flashback.state.EditorStateManager;
|
|||||||
import com.moulberry.flashback.editor.ui.ReplayUI;
|
import com.moulberry.flashback.editor.ui.ReplayUI;
|
||||||
import net.minecraft.client.renderer.MultiBufferSource;
|
import net.minecraft.client.renderer.MultiBufferSource;
|
||||||
import net.minecraft.client.renderer.RenderType;
|
import net.minecraft.client.renderer.RenderType;
|
||||||
|
import net.minecraft.client.renderer.culling.Frustum;
|
||||||
import net.minecraft.client.renderer.entity.EntityRenderDispatcher;
|
import net.minecraft.client.renderer.entity.EntityRenderDispatcher;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraft.world.level.LevelReader;
|
import net.minecraft.world.level.LevelReader;
|
||||||
@@ -17,6 +18,7 @@ import org.spongepowered.asm.mixin.Shadow;
|
|||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
@Mixin(value = EntityRenderDispatcher.class, priority = 990)
|
@Mixin(value = EntityRenderDispatcher.class, priority = 990)
|
||||||
public abstract class MixinEntityRenderDispatcher {
|
public abstract class MixinEntityRenderDispatcher {
|
||||||
@@ -25,6 +27,17 @@ public abstract class MixinEntityRenderDispatcher {
|
|||||||
private static void renderHitbox(PoseStack poseStack, VertexConsumer vertexConsumer, Entity entity, float f, float g, float h, float i) {
|
private static void renderHitbox(PoseStack poseStack, VertexConsumer vertexConsumer, Entity entity, float f, float g, float h, float i) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Inject(method = "shouldRender", at = @At("HEAD"), cancellable = true)
|
||||||
|
public void shouldRender(Entity entity, Frustum frustum, double d, double e, double f, CallbackInfoReturnable<Boolean> cir) {
|
||||||
|
EditorState editorState = EditorStateManager.getCurrent();
|
||||||
|
if (editorState != null && !editorState.filteredEntities.isEmpty()) {
|
||||||
|
String id = entity.getType().builtInRegistryHolder().key().location().toString();
|
||||||
|
if (editorState.filteredEntities.contains(id)) {
|
||||||
|
cir.setReturnValue(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Inject(method = "render", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "render", at = @At("HEAD"), cancellable = true)
|
||||||
public void renderBefore(Entity entity, double d, double e, double f, float g, float h, PoseStack poseStack, MultiBufferSource multiBufferSource, int i, CallbackInfo ci) {
|
public void renderBefore(Entity entity, double d, double e, double f, float g, float h, PoseStack poseStack, MultiBufferSource multiBufferSource, int i, CallbackInfo ci) {
|
||||||
if (Flashback.isExporting()) {
|
if (Flashback.isExporting()) {
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package com.moulberry.flashback.mixin.visuals;
|
||||||
|
|
||||||
|
import com.moulberry.flashback.state.EditorState;
|
||||||
|
import com.moulberry.flashback.state.EditorStateManager;
|
||||||
|
import net.minecraft.client.particle.Particle;
|
||||||
|
import net.minecraft.client.particle.ParticleEngine;
|
||||||
|
import net.minecraft.core.particles.ParticleOptions;
|
||||||
|
import net.minecraft.core.particles.ParticleType;
|
||||||
|
import net.minecraft.core.registries.BuiltInRegistries;
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
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(ParticleEngine.class)
|
||||||
|
public class MixinParticleEngine {
|
||||||
|
|
||||||
|
@Inject(method = "createParticle", at = @At("HEAD"), cancellable = true)
|
||||||
|
public void createParticle(ParticleOptions particleOptions, double d, double e, double f, double g, double h, double i, CallbackInfoReturnable<Particle> cir) {
|
||||||
|
EditorState editorState = EditorStateManager.getCurrent();
|
||||||
|
if (editorState != null && !editorState.filteredParticles.isEmpty()) {
|
||||||
|
ParticleType<?> particleType = particleOptions.getType();
|
||||||
|
ResourceLocation resourceLocation = BuiltInRegistries.PARTICLE_TYPE.getKey(particleType);
|
||||||
|
if (resourceLocation != null && editorState.filteredParticles.contains(resourceLocation.toString())) {
|
||||||
|
cir.setReturnValue(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -53,6 +53,8 @@ public class EditorState {
|
|||||||
public Map<UUID, String> nameOverride = new HashMap<>();
|
public Map<UUID, String> nameOverride = new HashMap<>();
|
||||||
public Set<UUID> hideTeamPrefix = new HashSet<>();
|
public Set<UUID> hideTeamPrefix = new HashSet<>();
|
||||||
public Set<UUID> hideTeamSuffix = new HashSet<>();
|
public Set<UUID> hideTeamSuffix = new HashSet<>();
|
||||||
|
public Set<String> filteredEntities = new HashSet<>();
|
||||||
|
public Set<String> filteredParticles = new HashSet<>();
|
||||||
|
|
||||||
public EditorState() {
|
public EditorState() {
|
||||||
this.scenes = new ArrayList<>();
|
this.scenes = new ArrayList<>();
|
||||||
|
|||||||
@@ -44,6 +44,7 @@
|
|||||||
"visuals.MixinLoadingOverlay",
|
"visuals.MixinLoadingOverlay",
|
||||||
"visuals.MixinMouseHandler",
|
"visuals.MixinMouseHandler",
|
||||||
"visuals.MixinOptions",
|
"visuals.MixinOptions",
|
||||||
|
"visuals.MixinParticleEngine",
|
||||||
"visuals.MixinPlayer"
|
"visuals.MixinPlayer"
|
||||||
],
|
],
|
||||||
"injectors": {
|
"injectors": {
|
||||||
|
|||||||
Reference in new issue
Block a user