1.21 Port I

This commit is contained in:
IThundxr 2024-07-10 11:27:18 -04:00
parent eccbfbc649
commit d587ec0ec8
Failed to generate hash of commit
19 changed files with 102 additions and 164 deletions

View file

@ -7,7 +7,7 @@ jobs:
strategy:
matrix:
java: [
17 # Current Java LTS & minimum supported by Minecraft
21 # Current Java LTS & minimum supported by Minecraft
]
os: [ ubuntu-latest ]
runs-on: ${{ matrix.os }}

View file

@ -9,6 +9,6 @@ public final class Flywheel {
}
public static ResourceLocation rl(String path) {
return new ResourceLocation(ID, path);
return ResourceLocation.fromNamespaceAndPath(ID, path);
}
}

View file

@ -6,7 +6,7 @@ import net.minecraft.client.renderer.Sheets;
import net.minecraft.resources.ResourceLocation;
public final class Materials {
private static final ResourceLocation MINECART_LOCATION = new ResourceLocation("textures/entity/minecart.png");
private static final ResourceLocation MINECART_LOCATION = ResourceLocation.withDefaultNamespace("textures/entity/minecart.png");
public static final Material CHUNK_SOLID_SHADED = SimpleMaterial.builder()
.build();

View file

@ -5,7 +5,7 @@ import java.nio.ByteBuffer;
import org.jetbrains.annotations.Nullable;
import org.lwjgl.system.MemoryUtil;
import com.mojang.blaze3d.vertex.BufferBuilder;
import com.mojang.blaze3d.vertex.MeshData;
import dev.engine_room.flywheel.api.vertex.VertexView;
import dev.engine_room.flywheel.lib.memory.MemoryBlock;
@ -16,15 +16,15 @@ final class MeshHelper {
private MeshHelper() {
}
public static SimpleMesh blockVerticesToMesh(BufferBuilder.RenderedBuffer buffer, @Nullable String meshDescriptor) {
BufferBuilder.DrawState drawState = buffer.drawState();
public static SimpleMesh blockVerticesToMesh(MeshData data, @Nullable String meshDescriptor) {
MeshData.DrawState drawState = data.drawState();
int vertexCount = drawState.vertexCount();
long srcStride = drawState.format().getVertexSize();
VertexView vertexView = new NoOverlayVertexView();
long dstStride = vertexView.stride();
ByteBuffer src = buffer.vertexBuffer();
ByteBuffer src = data.vertexBuffer();
MemoryBlock dst = MemoryBlock.malloc((long) vertexCount * dstStride);
long srcPtr = MemoryUtil.memAddress(src);
long dstPtr = dst.ptr();

View file

@ -4,7 +4,7 @@ import java.util.ArrayList;
import java.util.List;
import net.minecraft.client.resources.model.BakedModel;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.client.resources.model.ModelResourceLocation;
/**
* A helper class for loading and accessing JSON models not directly used by any blocks or items.
@ -19,10 +19,10 @@ public class PartialModel {
static final List<PartialModel> ALL = new ArrayList<>();
static boolean tooLate = false;
protected final ResourceLocation modelLocation;
protected final ModelResourceLocation modelLocation;
protected BakedModel bakedModel;
public PartialModel(ResourceLocation modelLocation) {
public PartialModel(ModelResourceLocation modelLocation) {
if (tooLate) {
throw new RuntimeException("Attempted to create PartialModel with location '" + modelLocation + "' after start of initial resource reload!");
}
@ -34,7 +34,7 @@ public class PartialModel {
}
}
public ResourceLocation getLocation() {
public ModelResourceLocation getLocation() {
return modelLocation;
}

View file

@ -26,67 +26,46 @@ class TransformingVertexConsumer implements VertexConsumer {
}
@Override
public VertexConsumer vertex(double x, double y, double z) {
public VertexConsumer addVertex(float x, float y, float z) {
Matrix4f matrix = poseStack.last().pose();
float fx = (float) x;
float fy = (float) y;
float fz = (float) z;
delegate.vertex(
MatrixMath.transformPositionX(matrix, fx, fy, fz),
MatrixMath.transformPositionY(matrix, fx, fy, fz),
MatrixMath.transformPositionZ(matrix, fx, fy, fz));
delegate.addVertex(
MatrixMath.transformPositionX(matrix, x, y, z),
MatrixMath.transformPositionY(matrix, x, y, z),
MatrixMath.transformPositionZ(matrix, x, y, z));
return this;
}
@Override
public VertexConsumer color(int red, int green, int blue, int alpha) {
delegate.color(red, green, blue, alpha);
public VertexConsumer setColor(int red, int green, int blue, int alpha) {
delegate.setColor(red, green, blue, alpha);
return this;
}
@Override
public VertexConsumer uv(float u, float v) {
delegate.uv(u, v);
public VertexConsumer setUv(float u, float v) {
delegate.setUv(u, v);
return this;
}
@Override
public VertexConsumer overlayCoords(int u, int v) {
delegate.overlayCoords(u, v);
public VertexConsumer setUv1(int u, int v) {
delegate.setUv1(u, v);
return this;
}
@Override
public VertexConsumer uv2(int u, int v) {
delegate.uv2(u, v);
public VertexConsumer setUv2(int u, int v) {
delegate.setUv2(u, v);
return this;
}
@Override
public VertexConsumer normal(float x, float y, float z) {
public VertexConsumer setNormal(float x, float y, float z) {
Matrix3f matrix = poseStack.last().normal();
float fx = (float) x;
float fy = (float) y;
float fz = (float) z;
delegate.normal(
MatrixMath.transformNormalX(matrix, fx, fy, fz),
MatrixMath.transformNormalY(matrix, fx, fy, fz),
MatrixMath.transformNormalZ(matrix, fx, fy, fz));
delegate.setNormal(
MatrixMath.transformNormalX(matrix, x, y, z),
MatrixMath.transformNormalY(matrix, x, y, z),
MatrixMath.transformNormalZ(matrix, x, y, z));
return this;
}
@Override
public void endVertex() {
delegate.endVertex();
}
@Override
public void defaultColor(int red, int green, int blue, int alpha) {
delegate.defaultColor(red, green, blue, alpha);
}
@Override
public void unsetDefaultColor() {
delegate.unsetDefaultColor();
}
}

View file

@ -34,25 +34,24 @@ class VertexWriter implements VertexConsumer {
}
@Override
public VertexConsumer vertex(double x, double y, double z) {
public VertexConsumer addVertex(float x, float y, float z) {
if (!filledPosition) {
long ptr = vertexPtr();
MemoryUtil.memPutFloat(ptr, (float) x);
MemoryUtil.memPutFloat(ptr + 4, (float) y);
MemoryUtil.memPutFloat(ptr + 8, (float) z);
MemoryUtil.memPutFloat(ptr, x);
MemoryUtil.memPutFloat(ptr + 4, y);
MemoryUtil.memPutFloat(ptr + 8, z);
filledPosition = true;
}
return this;
return endVertexIfNeeded();
}
@Override
public VertexConsumer color(int red, int green, int blue, int alpha) {
// ignore color
return this;
public VertexConsumer setColor(int red, int green, int blue, int alpha) {
return endVertexIfNeeded();
}
@Override
public VertexConsumer uv(float u, float v) {
public VertexConsumer setUv(float u, float v) {
if (!filledTexture) {
if (textureMapper != null) {
uvVec.set(u, v);
@ -66,23 +65,23 @@ class VertexWriter implements VertexConsumer {
MemoryUtil.memPutFloat(ptr + 16, v);
filledTexture = true;
}
return this;
return endVertexIfNeeded();
}
@Override
public VertexConsumer overlayCoords(int u, int v) {
public VertexConsumer setUv1(int u, int v) {
// ignore overlay
return this;
return endVertexIfNeeded();
}
@Override
public VertexConsumer uv2(int u, int v) {
public VertexConsumer setUv2(int u, int v) {
// ignore light
return this;
return endVertexIfNeeded();
}
@Override
public VertexConsumer normal(float x, float y, float z) {
public VertexConsumer setNormal(float x, float y, float z) {
if (!filledNormal) {
long ptr = vertexPtr();
MemoryUtil.memPutByte(ptr + 20, RenderMath.nb(x));
@ -90,13 +89,12 @@ class VertexWriter implements VertexConsumer {
MemoryUtil.memPutByte(ptr + 22, RenderMath.nb(z));
filledNormal = true;
}
return this;
return endVertexIfNeeded();
}
@Override
public void endVertex() {
public VertexConsumer endVertexIfNeeded() {
if (!filledPosition || !filledTexture || !filledNormal) {
throw new IllegalStateException("Not filled all elements of the vertex");
return this;
}
filledPosition = false;
@ -109,14 +107,8 @@ class VertexWriter implements VertexConsumer {
if (byteSize > capacity) {
data = data.realloc(capacity * 2);
}
}
@Override
public void defaultColor(int red, int green, int blue, int alpha) {
}
@Override
public void unsetDefaultColor() {
return this;
}
private long vertexPtr() {

View file

@ -30,7 +30,7 @@ public final class ResourceUtil {
}
}
return new ResourceLocation(namespace, path);
return ResourceLocation.fromNamespaceAndPath(namespace, path);
}
/**

View file

@ -44,7 +44,7 @@ import net.minecraft.world.phys.shapes.VoxelShape;
*/
public class ShadowComponent implements EntityComponent {
private static final Material SHADOW_MATERIAL = SimpleMaterial.builder()
.texture(new ResourceLocation("textures/misc/shadow.png"))
.texture(ResourceLocation.withDefaultNamespace("textures/misc/shadow.png"))
.mipmap(false)
.polygonOffset(true) // vanilla shadows use "view offset" but this seems to work fine
.transparency(Transparency.TRANSLUCENT)

View file

@ -4,7 +4,7 @@ import java.util.Iterator;
import org.jetbrains.annotations.Nullable;
import com.mojang.blaze3d.vertex.BufferBuilder.RenderedBuffer;
import com.mojang.blaze3d.vertex.MeshData;
import com.mojang.blaze3d.vertex.PoseStack;
import it.unimi.dsi.fastutil.objects.Reference2ReferenceMap;
@ -129,7 +129,7 @@ final class BakedModelBufferer {
}
public interface ResultConsumer {
void accept(RenderType renderType, boolean shaded, RenderedBuffer data);
void accept(RenderType renderType, boolean shaded, MeshData data);
}
private static class ThreadLocalObjects {

View file

@ -56,69 +56,54 @@ class UniversalMeshEmitter implements VertexConsumer {
}
@Override
public VertexConsumer vertex(double x, double y, double z) {
currentDelegate.vertex(x, y, z);
public VertexConsumer addVertex(float x, float y, float z) {
currentDelegate.addVertex(x, y, z);
return this;
}
@Override
public VertexConsumer color(int red, int green, int blue, int alpha) {
currentDelegate.color(red, green, blue, alpha);
public VertexConsumer setColor(int red, int green, int blue, int alpha) {
currentDelegate.setColor(red, green, blue, alpha);
return this;
}
@Override
public VertexConsumer uv(float u, float v) {
currentDelegate.uv(u, v);
public VertexConsumer setUv(float u, float v) {
currentDelegate.setUv(u, v);
return this;
}
@Override
public VertexConsumer overlayCoords(int u, int v) {
currentDelegate.overlayCoords(u, v);
public VertexConsumer setUv1(int u, int v) {
currentDelegate.setUv1(u, v);
return this;
}
@Override
public VertexConsumer uv2(int u, int v) {
currentDelegate.uv2(u, v);
public VertexConsumer setUv2(int u, int v) {
currentDelegate.setUv2(u, v);
return this;
}
@Override
public VertexConsumer normal(float x, float y, float z) {
currentDelegate.normal(x, y, z);
public VertexConsumer setNormal(float x, float y, float z) {
currentDelegate.setNormal(x, y, z);
return this;
}
@Override
public void endVertex() {
currentDelegate.endVertex();
public void addVertex(float x, float y, float z, int color, float u, float v, int packedOverlay, int packedLight, float normalX, float normalY, float normalZ) {
currentDelegate.addVertex(x, y, z, color, u, v, packedOverlay, packedLight, normalX, normalY, normalZ);
}
@Override
public void defaultColor(int red, int green, int blue, int alpha) {
currentDelegate.defaultColor(red, green, blue, alpha);
public void putBulkData(PoseStack.Pose pose, BakedQuad quad, float red, float green, float blue, float alpha, int packedLight, int packedOverlay) {
currentDelegate.putBulkData(pose, quad, red, green, blue, alpha, packedLight, packedOverlay);
}
@Override
public void unsetDefaultColor() {
currentDelegate.unsetDefaultColor();
}
@Override
public void vertex(float x, float y, float z, float red, float green, float blue, float alpha, float u, float v, int overlay, int light, float normalX, float normalY, float normalZ) {
currentDelegate.vertex(x, y, z, red, green, blue, alpha, u, v, overlay, light, normalX, normalY, normalZ);
}
@Override
public void putBulkData(PoseStack.Pose pose, BakedQuad quad, float red, float green, float blue, int light, int overlay) {
currentDelegate.putBulkData(pose, quad, red, green, blue, light, overlay);
}
@Override
public void putBulkData(PoseStack.Pose pose, BakedQuad quad, float[] brightnesses, float red, float green, float blue, int[] lights, int overlay, boolean readExistingColor) {
currentDelegate.putBulkData(pose, quad, brightnesses, red, green, blue, lights, overlay, readExistingColor);
public void putBulkData(PoseStack.Pose pose, BakedQuad quad, float[] brightness, float red, float green, float blue, float alpha, int[] lightmap, int packedOverlay, boolean readAlpha) {
currentDelegate.putBulkData(pose, quad, brightness, red, green, blue, alpha, lightmap, packedOverlay, readAlpha);
}
private class WrapperModel extends ForwardingBakedModel {

View file

@ -99,7 +99,7 @@ public class FabricFlwConfig implements FlwConfig {
if (backendJson instanceof JsonPrimitive primitive && primitive.isString()) {
var value = primitive.getAsString();
try {
this.backend = Backend.REGISTRY.getOrThrow(new ResourceLocation(value));
this.backend = Backend.REGISTRY.getOrThrow(ResourceLocation.parse(value));
return;
} catch (ResourceLocationException e) {
msg = "'backend' value '" + value + "' is not a valid resource location";

View file

@ -5,7 +5,7 @@ import java.util.function.Function;
import org.jetbrains.annotations.Nullable;
import com.mojang.blaze3d.vertex.BufferBuilder.RenderedBuffer;
import com.mojang.blaze3d.vertex.MeshData;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.renderer.ItemBlockRenderTypes;
@ -130,7 +130,7 @@ final class BakedModelBufferer {
}
public interface ResultConsumer {
void accept(RenderType renderType, boolean shaded, RenderedBuffer data);
void accept(RenderType renderType, boolean shaded, MeshData data);
}
private static class ThreadLocalObjects {

View file

@ -63,12 +63,6 @@ class MeshEmitter implements VertexConsumer {
}
}
@Override
public void putBulkData(PoseStack.Pose pose, BakedQuad quad, float red, float green, float blue, int light, int overlay) {
prepareForGeometry(quad);
bufferBuilder.putBulkData(pose, quad, red, green, blue, light, overlay);
}
@Override
public void putBulkData(PoseStack.Pose pose, BakedQuad quad, float red, float green, float blue, float alpha, int light, int overlay, boolean readExistingColor) {
prepareForGeometry(quad);
@ -76,9 +70,9 @@ class MeshEmitter implements VertexConsumer {
}
@Override
public void putBulkData(PoseStack.Pose pose, BakedQuad quad, float[] brightnesses, float red, float green, float blue, int[] lights, int overlay, boolean readExistingColor) {
public void putBulkData(PoseStack.Pose pose, BakedQuad quad, float red, float green, float blue, float alpha, int packedLight, int packedOverlay) {
prepareForGeometry(quad);
bufferBuilder.putBulkData(pose, quad, brightnesses, red, green, blue, lights, overlay, readExistingColor);
bufferBuilder.putBulkData(pose, quad, red, green, blue, alpha, packedLight, packedOverlay);
}
@Override
@ -88,47 +82,32 @@ class MeshEmitter implements VertexConsumer {
}
@Override
public VertexConsumer vertex(double x, double y, double z) {
public VertexConsumer addVertex(float x, float y, float z) {
throw new UnsupportedOperationException("MeshEmitter only supports putBulkData!");
}
@Override
public VertexConsumer color(int red, int green, int blue, int alpha) {
public VertexConsumer setColor(int red, int green, int blue, int alpha) {
throw new UnsupportedOperationException("MeshEmitter only supports putBulkData!");
}
@Override
public VertexConsumer uv(float u, float v) {
public VertexConsumer setUv(float u, float v) {
throw new UnsupportedOperationException("MeshEmitter only supports putBulkData!");
}
@Override
public VertexConsumer overlayCoords(int u, int v) {
public VertexConsumer setUv1(int u, int v) {
throw new UnsupportedOperationException("MeshEmitter only supports putBulkData!");
}
@Override
public VertexConsumer uv2(int u, int v) {
public VertexConsumer setUv2(int u, int v) {
throw new UnsupportedOperationException("MeshEmitter only supports putBulkData!");
}
@Override
public VertexConsumer normal(float x, float y, float z) {
throw new UnsupportedOperationException("MeshEmitter only supports putBulkData!");
}
@Override
public void endVertex() {
throw new UnsupportedOperationException("MeshEmitter only supports putBulkData!");
}
@Override
public void defaultColor(int red, int green, int blue, int alpha) {
throw new UnsupportedOperationException("MeshEmitter only supports putBulkData!");
}
@Override
public void unsetDefaultColor() {
public VertexConsumer setNormal(float normalX, float normalY, float normalZ) {
throw new UnsupportedOperationException("MeshEmitter only supports putBulkData!");
}
}

View file

@ -5,7 +5,7 @@ import java.util.Map;
import org.jetbrains.annotations.ApiStatus;
import net.minecraft.client.resources.model.BakedModel;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.client.resources.model.ModelResourceLocation;
import net.neoforged.neoforge.client.event.ModelEvent;
@ApiStatus.Internal
@ -22,7 +22,7 @@ public final class PartialModelEventHandler {
}
public static void onBakingCompleted(ModelEvent.BakingCompleted event) {
Map<ResourceLocation, BakedModel> models = event.getModels();
Map<ModelResourceLocation, BakedModel> models = event.getModels();
for (PartialModel partial : PartialModel.ALL) {
partial.set(models.get(partial.getLocation()));

View file

@ -1,5 +1,7 @@
package dev.engine_room.flywheel.impl;
import java.util.function.Supplier;
import org.apache.maven.artifact.versioning.ArtifactVersion;
import org.jetbrains.annotations.UnknownNullability;
@ -18,22 +20,20 @@ import dev.engine_room.flywheel.lib.util.LevelAttached;
import net.minecraft.client.Minecraft;
import net.minecraft.commands.synchronization.ArgumentTypeInfos;
import net.minecraft.core.registries.Registries;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.bus.api.IEventBus;
import net.neoforged.fml.CrashReportCallables;
import net.neoforged.fml.DistExecutor;
import net.neoforged.fml.LogicalSide;
import net.neoforged.fml.ModContainer;
import net.neoforged.fml.ModLoadingContext;
import net.neoforged.fml.common.Mod;
import net.neoforged.fml.event.lifecycle.FMLCommonSetupEvent;
import net.neoforged.fml.loading.FMLLoader;
import net.neoforged.neoforge.client.event.CustomizeGuiOverlayEvent;
import net.neoforged.neoforge.client.event.RegisterClientReloadListenersEvent;
import net.neoforged.neoforge.common.NeoForge;
import net.neoforged.neoforge.event.TickEvent;
import net.neoforged.neoforge.event.entity.EntityJoinLevelEvent;
import net.neoforged.neoforge.event.entity.EntityLeaveLevelEvent;
import net.neoforged.neoforge.event.level.LevelEvent;
import net.neoforged.neoforge.event.tick.LevelTickEvent;
import net.neoforged.neoforge.registries.RegisterEvent;
@Mod(Flywheel.ID)
@ -50,9 +50,12 @@ public final class FlywheelForge {
IEventBus forgeEventBus = NeoForge.EVENT_BUS;
ForgeFlwConfig.INSTANCE.registerSpecs(modLoadingContext);
ForgeFlwConfig.INSTANCE.registerSpecs(modContainer);
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> FlywheelForge.clientInit(forgeEventBus, modEventBus));
if (FMLLoader.getDist().isClient()) {
Supplier<Runnable> toRun = () -> () -> FlywheelForge.clientInit(forgeEventBus, modEventBus);
toRun.get().run();
}
}
private static void clientInit(IEventBus forgeEventBus, IEventBus modEventBus) {
@ -67,10 +70,10 @@ public final class FlywheelForge {
private static void registerImplEventListeners(IEventBus forgeEventBus, IEventBus modEventBus) {
forgeEventBus.addListener((ReloadLevelRendererEvent e) -> BackendManagerImpl.onReloadLevelRenderer(e.level()));
forgeEventBus.addListener((TickEvent.LevelTickEvent e) -> {
forgeEventBus.addListener((LevelTickEvent.Post e) -> {
// Make sure we don't tick on the server somehow.
if (e.phase == TickEvent.Phase.END && e.side == LogicalSide.CLIENT) {
VisualizationEventHandler.onClientTick(Minecraft.getInstance(), e.level);
if (FMLLoader.getDist().isClient()) {
VisualizationEventHandler.onClientTick(Minecraft.getInstance(), e.getLevel());
}
});
forgeEventBus.addListener((BeginFrameEvent e) -> VisualizationEventHandler.onBeginFrame(e.context()));

View file

@ -7,7 +7,7 @@ import dev.engine_room.flywheel.api.backend.Backend;
import dev.engine_room.flywheel.api.backend.BackendManager;
import net.minecraft.ResourceLocationException;
import net.minecraft.resources.ResourceLocation;
import net.neoforged.fml.ModLoadingContext;
import net.neoforged.fml.ModContainer;
import net.neoforged.fml.config.ModConfig;
import net.neoforged.neoforge.common.ModConfigSpec;
@ -38,7 +38,7 @@ public class ForgeFlwConfig implements FlwConfig {
private static Backend parseBackend(String idStr) {
ResourceLocation backendId;
try {
backendId = new ResourceLocation(idStr);
backendId = ResourceLocation.parse(idStr);
} catch (ResourceLocationException e) {
FlwImpl.CONFIG_LOGGER.warn("'backend' value '{}' is not a valid resource location", idStr);
return null;
@ -63,7 +63,7 @@ public class ForgeFlwConfig implements FlwConfig {
return client.workerThreads.get();
}
public void registerSpecs(ModLoadingContext context) {
public void registerSpecs(ModContainer context) {
context.registerConfig(ModConfig.Type.CLIENT, clientSpec);
}

View file

@ -17,7 +17,7 @@ import dev.engine_room.flywheel.api.event.EndClientResourceReloadEvent;
import dev.engine_room.flywheel.impl.FlwImpl;
import net.minecraft.client.Minecraft;
import net.minecraft.server.packs.resources.ReloadableResourceManager;
import net.neoforged.fml.ModLoader;
import net.neoforged.neoforge.common.NeoForge;
@Mixin(Minecraft.class)
abstract class MinecraftMixin {
@ -34,11 +34,11 @@ abstract class MinecraftMixin {
@Inject(method = "lambda$new$7", at = @At("HEAD"))
private void flywheel$onEndInitialResourceReload(@Coerce Object gameLoadCookie, Optional<Throwable> error, CallbackInfo ci) {
ModLoader.get().postEvent(new EndClientResourceReloadEvent((Minecraft) (Object) this, resourceManager, true, error));
NeoForge.EVENT_BUS.post(new EndClientResourceReloadEvent((Minecraft) (Object) this, resourceManager, true, error));
}
@Inject(method = "lambda$reloadResourcePacks$39", at = @At("HEAD"))
private void flywheel$onEndManualResourceReload(boolean recovery, @Coerce Object gameLoadCookie, CompletableFuture<Void> completablefuture, Optional<Throwable> error, CallbackInfo ci) {
ModLoader.get().postEvent(new EndClientResourceReloadEvent((Minecraft) (Object) this, resourceManager, false, error));
NeoForge.EVENT_BUS.post(new EndClientResourceReloadEvent((Minecraft) (Object) this, resourceManager, false, error));
}
}

View file

@ -1,18 +1,18 @@
package dev.engine_room.flywheel.impl.mixin.sodium;
import org.embeddedt.embeddium.impl.render.chunk.compile.tasks.ChunkBuilderMeshingTask;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import dev.engine_room.flywheel.lib.visual.VisualizationHelper;
import me.jellysquid.mods.sodium.client.render.chunk.compile.tasks.ChunkBuilderMeshingTask;
import net.minecraft.client.renderer.blockentity.BlockEntityRenderDispatcher;
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
import net.minecraft.world.level.block.entity.BlockEntity;
@Mixin(value = ChunkBuilderMeshingTask.class, remap = false)
abstract class ChunkBuilderMeshingTaskMixin {
@Redirect(method = "execute", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/blockentity/BlockEntityRenderDispatcher;getRenderer(Lnet/minecraft/world/level/block/entity/BlockEntity;)Lnet/minecraft/client/renderer/blockentity/BlockEntityRenderer;", remap = true))
@Redirect(method = "execute(Lorg/embeddedt/embeddium/impl/render/chunk/compile/ChunkBuildContext;Lorg/embeddedt/embeddium/impl/util/task/CancellationToken;)Lorg/embeddedt/embeddium/impl/render/chunk/compile/ChunkBuildOutput;", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/blockentity/BlockEntityRenderDispatcher;getRenderer(Lnet/minecraft/world/level/block/entity/BlockEntity;)Lnet/minecraft/client/renderer/blockentity/BlockEntityRenderer;", remap = true))
private BlockEntityRenderer<?> flywheel$redirectGetRenderer(BlockEntityRenderDispatcher dispatcher, BlockEntity blockEntity) {
if (VisualizationHelper.tryAddBlockEntity(blockEntity)) {
return null;