not unscuffed, just differently scuffed

This commit is contained in:
Leijurv
2020-02-13 18:57:32 -08:00
parent db2f6ec78d
commit 746b7b5c88
5 changed files with 29 additions and 29 deletions

View File

@@ -18,6 +18,7 @@
package baritone.api.event.events;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.client.renderer.Matrix4f;
/**
* @author Brady
@@ -30,12 +31,13 @@ public final class RenderEvent {
*/
private final float partialTicks;
private final MatrixStack modelViewStack, projectionStack;
private final Matrix4f projectionMatrix;
private final MatrixStack modelViewStack;
public RenderEvent(float partialTicks, MatrixStack modelViewStack, MatrixStack projectionStack) {
public RenderEvent(float partialTicks, MatrixStack modelViewStack, Matrix4f projectionMatrix) {
this.partialTicks = partialTicks;
this.modelViewStack = modelViewStack;
this.projectionStack = projectionStack;
this.projectionMatrix = projectionMatrix;
}
/**
@@ -45,11 +47,11 @@ public final class RenderEvent {
return this.partialTicks;
}
public final MatrixStack getModelViewStack() {
public MatrixStack getModelViewStack() {
return this.modelViewStack;
}
public final MatrixStack getProjectionStack() {
return this.projectionStack;
public Matrix4f getProjectionMatrix() {
return this.projectionMatrix;
}
}

View File

@@ -21,30 +21,28 @@ import baritone.api.BaritoneAPI;
import baritone.api.IBaritone;
import baritone.api.event.events.RenderEvent;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.client.renderer.ActiveRenderInfo;
import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.client.renderer.Matrix4f;
import net.minecraft.client.renderer.*;
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 org.spongepowered.asm.mixin.injection.callback.LocalCapture;
@Mixin(GameRenderer.class)
public class MixinGameRenderer {
/**
* @author Brady
* @since 2/13/2020
*/
@Mixin(WorldRenderer.class)
public class MixinWorldRenderer {
@Inject(
method = "renderWorld",
at = @At(
value = "INVOKE_STRING",
target = "Lnet/minecraft/profiler/IProfiler;endStartSection(Ljava/lang/String;)V",
args = {"ldc=hand"}
),
locals = LocalCapture.CAPTURE_FAILHARD
method = "updateCameraAndRender",
at = @At("RETURN"),
locals = LocalCapture.CAPTURE_FAILSOFT
)
private void renderWorldPass(float partialTicks, long finishTimeNano, MatrixStack modelViewMatrix, CallbackInfo ci, boolean flag, ActiveRenderInfo activerenderinfo, MatrixStack projectionMatrix, float f, Matrix4f matrix4f) {
private void onStartHand(MatrixStack matrixStackIn, float partialTicks, long finishTimeNano, boolean drawBlockOutline, ActiveRenderInfo activeRenderInfoIn, GameRenderer gameRendererIn, LightTexture lightmapIn, Matrix4f projectionIn, CallbackInfo ci) {
for (IBaritone ibaritone : BaritoneAPI.getProvider().getAllBaritones()) {
ibaritone.getGameEventHandler().onRenderPass(new RenderEvent(partialTicks, modelViewMatrix, projectionMatrix));
ibaritone.getGameEventHandler().onRenderPass(new RenderEvent(partialTicks, matrixStackIn, projectionIn));
}
}
}
}

View File

@@ -9,14 +9,13 @@
},
"client": [
"MixinBitArray",
"MixinCommandSuggestionHelper",
"MixinChunkArray",
"MixinClientChunkProvider",
"MixinClientPlayerEntity",
"MixinClientPlayNetHandler",
"MixinCommandSuggestionHelper",
"MixinEntity",
"MixinEntityRenderManager",
"MixinGameRenderer",
"MixinItemStack",
"MixinLivingEntity",
"MixinLootContext",
@@ -24,6 +23,7 @@
"MixinNetworkManager",
"MixinPalettedContainer",
"MixinPlayerController",
"MixinScreen"
"MixinScreen",
"MixinWorldRenderer"
]
}

View File

@@ -110,8 +110,8 @@ public class GuiClick extends Screen implements Helper {
return super.mouseClicked(mouseX, mouseY, mouseButton);
}
public void onRender(MatrixStack modelViewStack, MatrixStack projectionStack) {
this.projectionViewMatrix = projectionStack.getLast().getMatrix().copy();
public void onRender(MatrixStack modelViewStack, Matrix4f projectionMatrix) {
this.projectionViewMatrix = projectionMatrix.copy();
this.projectionViewMatrix.mul(modelViewStack.getLast().getMatrix());
this.projectionViewMatrix.invert();
@@ -144,8 +144,8 @@ public class GuiClick extends Screen implements Helper {
return null;
}
x /= mc.getMainWindow().getWidth();
y /= mc.getMainWindow().getHeight();
x /= mc.getMainWindow().getFramebufferWidth();
y /= mc.getMainWindow().getFramebufferHeight();
x = x * 2 - 1;
y = y * 2 - 1;

View File

@@ -74,7 +74,7 @@ public final class PathRenderer implements IRenderer, Helper {
float partialTicks = event.getPartialTicks();
Goal goal = behavior.getGoal();
if (Helper.mc.currentScreen instanceof GuiClick) {
((GuiClick) Helper.mc.currentScreen).onRender(event.getModelViewStack(), event.getProjectionStack());
((GuiClick) Helper.mc.currentScreen).onRender(event.getModelViewStack(), event.getProjectionMatrix());
}
int thisPlayerDimension = behavior.baritone.getPlayerContext().world().getDimension().getType().getId();