Skip to content

Commit

Permalink
Yeet the rest of the asm
Browse files Browse the repository at this point in the history
  • Loading branch information
Cadiboo committed Apr 8, 2024
1 parent 4ccc829 commit 2b720d3
Show file tree
Hide file tree
Showing 11 changed files with 79 additions and 474 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@
//
//import io.github.cadiboo.nocubes.NoCubes;
//import io.github.cadiboo.nocubes.config.NoCubesConfig;
//import io.github.cadiboo.nocubes.hooks.SelfCheck;
//import io.github.cadiboo.nocubes.network.NoCubesNetwork;
//import net.minecraft.client.Minecraft;
//import net.minecraft.client.gui.screens.Screen;
//import net.minecraftforge.api.distmarker.Dist;
//import net.minecraftforge.client.event.ClientPlayerNetworkEvent;
//import net.minecraftforge.event.TickEvent;
//import net.minecraftforge.eventbus.api.SubscribeEvent;
//import net.minecraftforge.fml.common.Mod;
//import net.minecraftforge.network.NetworkHooks;
Expand All @@ -23,25 +21,6 @@
//
// private static final Logger LOG = LogManager.getLogger();
//
// private static long selfCheckInfoPrintedAt = Long.MIN_VALUE;
//
// @SubscribeEvent
// public static void printDebugInfo(TickEvent.ClientTickEvent event) {
// if (!NoCubesConfig.Common.debugEnabled || !Screen.hasAltDown())
// return;
//
// var world = Minecraft.getInstance().level;
// if (world == null)
// return;
//
// long time = world.getGameTime();
// if (time - 10 * 20 <= selfCheckInfoPrintedAt)
// return; // Only print once every 10 seconds, don't spam the log
//
// selfCheckInfoPrintedAt = time;
// LogManager.getLogger("NoCubes Hooks SelfCheck").info(String.join("\n", SelfCheck.info()));
// }
//
// @SubscribeEvent
// public static void onClientJoinServer(ClientPlayerNetworkEvent.LoggingIn event) {
// LOG.debug("Client joined server");
Expand Down
70 changes: 0 additions & 70 deletions src/main/java/io/github/cadiboo/nocubes/hooks/ClientHooks.java
Original file line number Diff line number Diff line change
@@ -1,33 +1,16 @@
package io.github.cadiboo.nocubes.hooks;

import com.mojang.blaze3d.vertex.PoseStack;
import io.github.cadiboo.nocubes.NoCubes;
import io.github.cadiboo.nocubes.client.ClientUtil;
import io.github.cadiboo.nocubes.client.render.RendererDispatcher;
import io.github.cadiboo.nocubes.client.render.SodiumRenderer;
import io.github.cadiboo.nocubes.config.NoCubesConfig;
import io.github.cadiboo.nocubes.hooks.trait.INoCubesChunkSectionRender;
import io.github.cadiboo.nocubes.hooks.trait.INoCubesChunkSectionRenderBuilder;
import io.github.cadiboo.nocubes.hooks.trait.INoCubesChunkSectionRenderBuilderSodium;
import io.github.cadiboo.nocubes.mixin.client.RenderChunkRebuildTaskMixin;
import io.github.cadiboo.nocubes.util.ModUtil;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.renderer.ChunkBufferBuilderPack;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.block.BlockRenderDispatcher;
import net.minecraft.client.renderer.chunk.ChunkRenderDispatcher.RenderChunk;
import net.minecraft.client.renderer.chunk.VisGraph;
import net.minecraft.core.BlockPos;
import net.minecraft.util.RandomSource;
import net.minecraft.world.level.BlockAndTintGetter;
import net.minecraft.world.level.block.RenderShape;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.FluidState;
//import net.minecraftforge.api.distmarker.Dist;
//import net.minecraftforge.api.distmarker.OnlyIn;

import java.util.Set;


/**
Expand All @@ -38,59 +21,6 @@
@SuppressWarnings("unused") // Called via ASM
public final class ClientHooks {

/**
* Call injected by {@link MixinAsm#transformChunkRenderer}
*/
public static void preIteration(
// Fields (this, RenderChunk.this)
/*RenderChunk*/ Object rebuildTask, RenderChunk chunkRender,
// Params (p_234471_)
ChunkBufferBuilderPack buffers,
// Local variables
BlockPos chunkPos, BlockAndTintGetter world, PoseStack matrix,
// Scoped local variables
Set<RenderType> usedLayers, RandomSource random, BlockRenderDispatcher dispatcher
) {
SelfCheck.preIteration = true;
RendererDispatcher.renderChunk(
(INoCubesChunkSectionRenderBuilder) rebuildTask, (INoCubesChunkSectionRender) chunkRender, buffers,
chunkPos, world, matrix,
usedLayers, random, dispatcher
);
}

/**
* Same as {@link #preIteration} but for Sodium.
* Call injected by {@link MixinAsm#transformSodiumChunkRenderer}
*/
public static void preIterationSodium(
// Fields
Object chunkBuilderMeshingTask,
// Params
/*ChunkBuildContext*/ Object buildContext, /*CancellationToken*/ Object cancellationToken,
// Local variables
/*BuiltSectionInfo.Builder*/ Object renderData,
VisGraph occluder,
/*ChunkBuildBuffers*/ Object buffers,
/*BlockRenderCache*/ Object cache,
/*WorldSlice*/ Object slice,
int minX, int minY, int minZ,
int maxX, int maxY, int maxZ,
BlockPos.MutableBlockPos blockPos,
BlockPos.MutableBlockPos modelOffset,
/*BlockRenderContext*/ Object context
) {
SelfCheck.preIterationSodium = true;
SodiumRenderer.renderChunk(
(INoCubesChunkSectionRenderBuilderSodium) chunkBuilderMeshingTask,
buffers,
cache,
blockPos,
modelOffset,
context
);
}

/**
* Makes extended fluids render properly
* Called instead of {@link BlockState#getFluidState()}
Expand Down
1 change: 0 additions & 1 deletion src/main/java/io/github/cadiboo/nocubes/hooks/Hooks.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,4 @@ public static boolean collisionShapeOfSmoothBlockIntersectsEntityAABB(Entity ent
);
}


}
Loading

0 comments on commit 2b720d3

Please sign in to comment.