Skip to content

Update to new Reforged PR #62

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: b1.7.3
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package io.github.betterthanupdates.reforged.mixin.client;

import com.llamalad7.mixinextras.sugar.Local;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.class_555;
import net.minecraft.client.render.WorldRenderer;
import org.lwjgl.opengl.GL11;
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.CallbackInfo;
import reforged.ReforgedHooksClient;

@Environment(EnvType.CLIENT)
@Mixin(class_555.class) // EntityRenderer
public class RenderWorldLastMixin {

@Inject(method = "method_1841",
at = @At(value = "INVOKE", target = "Lnet/minecraft/class_555;method_1842(IF)V", ordinal = 4))
private void reforged$pushCloudMatrix(float f, long l, CallbackInfo ci) {
GL11.glPushMatrix();
}

@Inject(method = "method_1841",
at = @At(value = "INVOKE", target = "Lnet/minecraft/class_555;method_1842(IF)V", ordinal = 5,
shift = At.Shift.AFTER))
private void reforged$popCloudMatrixAndDraw(float f, long l, CallbackInfo ci, @Local WorldRenderer var5) {
GL11.glPopMatrix();
ReforgedHooksClient.onRenderWorldLast(var5, f);
}

}
12 changes: 12 additions & 0 deletions apron/src/main/java/reforged/IRenderWorldLastHandler.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package reforged;

import net.minecraft.client.render.WorldRenderer;

public interface IRenderWorldLastHandler {
/** Called after rendering all the 3D data of the world. This is
* called before the user's tool is rendered, but otherwise after all
* 3D content. It is called twice in anaglyph mode. This is intended
* for rendering visual effect overlays into the world.
*/
void onRenderWorldLast(WorldRenderer wr, float f);
}
17 changes: 17 additions & 0 deletions apron/src/main/java/reforged/ReforgedHooksClient.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package reforged;

import java.util.LinkedList;

import net.minecraft.client.render.WorldRenderer;

public class ReforgedHooksClient {

public static LinkedList<IRenderWorldLastHandler> renderWorldLastHandlers = new LinkedList<>();

public static void onRenderWorldLast(WorldRenderer wr, float f) {
for (IRenderWorldLastHandler handler : renderWorldLastHandlers) {
handler.onRenderWorldLast(wr, f);
}
}

}
1 change: 1 addition & 0 deletions apron/src/main/resources/reforged.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"client": [
"client.nostation.GameRendererMixin",
"client.MultiplayerInteractionManagerMixin",
"client.RenderWorldLastMixin",
"client.SingleplayerInteractionManagerMixin"
],
"plugin": "io.github.betterthanupdates.apron.ApronMixinPlugin",
Expand Down