mirror of
https://github.com/darksaid98/Flashback.git
synced 2026-12-02 06:28:48 +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
@@ -9,6 +9,7 @@ import com.moulberry.flashback.state.EditorStateManager;
|
||||
import com.moulberry.flashback.editor.ui.ReplayUI;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.culling.Frustum;
|
||||
import net.minecraft.client.renderer.entity.EntityRenderDispatcher;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
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.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(value = EntityRenderDispatcher.class, priority = 990)
|
||||
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) {
|
||||
}
|
||||
|
||||
@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)
|
||||
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()) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user