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
@@ -18,6 +18,7 @@
package baritone.api.event.events; package baritone.api.event.events;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.client.renderer.Matrix4f;
/** /**
* @author Brady * @author Brady
@@ -30,12 +31,13 @@ public final class RenderEvent {
*/ */
private final float partialTicks; 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.partialTicks = partialTicks;
this.modelViewStack = modelViewStack; this.modelViewStack = modelViewStack;
this.projectionStack = projectionStack; this.projectionMatrix = projectionMatrix;
} }
/** /**
@@ -45,11 +47,11 @@ public final class RenderEvent {
return this.partialTicks; return this.partialTicks;
} }
public final MatrixStack getModelViewStack() { public MatrixStack getModelViewStack() {
return this.modelViewStack; return this.modelViewStack;
} }
public final MatrixStack getProjectionStack() { public Matrix4f getProjectionMatrix() {
return this.projectionStack; return this.projectionMatrix;
} }
} }
@@ -21,30 +21,28 @@ import baritone.api.BaritoneAPI;
import baritone.api.IBaritone; import baritone.api.IBaritone;
import baritone.api.event.events.RenderEvent; import baritone.api.event.events.RenderEvent;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.client.renderer.ActiveRenderInfo; import net.minecraft.client.renderer.*;
import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.client.renderer.Matrix4f;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture; 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( @Inject(
method = "renderWorld", method = "updateCameraAndRender",
at = @At( at = @At("RETURN"),
value = "INVOKE_STRING", locals = LocalCapture.CAPTURE_FAILSOFT
target = "Lnet/minecraft/profiler/IProfiler;endStartSection(Ljava/lang/String;)V",
args = {"ldc=hand"}
),
locals = LocalCapture.CAPTURE_FAILHARD
) )
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()) { for (IBaritone ibaritone : BaritoneAPI.getProvider().getAllBaritones()) {
ibaritone.getGameEventHandler().onRenderPass(new RenderEvent(partialTicks, modelViewMatrix, projectionMatrix)); ibaritone.getGameEventHandler().onRenderPass(new RenderEvent(partialTicks, matrixStackIn, projectionIn));
} }
} }
} }
+3 -3
View File
@@ -9,14 +9,13 @@
}, },
"client": [ "client": [
"MixinBitArray", "MixinBitArray",
"MixinCommandSuggestionHelper",
"MixinChunkArray", "MixinChunkArray",
"MixinClientChunkProvider", "MixinClientChunkProvider",
"MixinClientPlayerEntity", "MixinClientPlayerEntity",
"MixinClientPlayNetHandler", "MixinClientPlayNetHandler",
"MixinCommandSuggestionHelper",
"MixinEntity", "MixinEntity",
"MixinEntityRenderManager", "MixinEntityRenderManager",
"MixinGameRenderer",
"MixinItemStack", "MixinItemStack",
"MixinLivingEntity", "MixinLivingEntity",
"MixinLootContext", "MixinLootContext",
@@ -24,6 +23,7 @@
"MixinNetworkManager", "MixinNetworkManager",
"MixinPalettedContainer", "MixinPalettedContainer",
"MixinPlayerController", "MixinPlayerController",
"MixinScreen" "MixinScreen",
"MixinWorldRenderer"
] ]
} }
+4 -4
View File
@@ -110,8 +110,8 @@ public class GuiClick extends Screen implements Helper {
return super.mouseClicked(mouseX, mouseY, mouseButton); return super.mouseClicked(mouseX, mouseY, mouseButton);
} }
public void onRender(MatrixStack modelViewStack, MatrixStack projectionStack) { public void onRender(MatrixStack modelViewStack, Matrix4f projectionMatrix) {
this.projectionViewMatrix = projectionStack.getLast().getMatrix().copy(); this.projectionViewMatrix = projectionMatrix.copy();
this.projectionViewMatrix.mul(modelViewStack.getLast().getMatrix()); this.projectionViewMatrix.mul(modelViewStack.getLast().getMatrix());
this.projectionViewMatrix.invert(); this.projectionViewMatrix.invert();
@@ -144,8 +144,8 @@ public class GuiClick extends Screen implements Helper {
return null; return null;
} }
x /= mc.getMainWindow().getWidth(); x /= mc.getMainWindow().getFramebufferWidth();
y /= mc.getMainWindow().getHeight(); y /= mc.getMainWindow().getFramebufferHeight();
x = x * 2 - 1; x = x * 2 - 1;
y = y * 2 - 1; y = y * 2 - 1;
@@ -74,7 +74,7 @@ public final class PathRenderer implements IRenderer, Helper {
float partialTicks = event.getPartialTicks(); float partialTicks = event.getPartialTicks();
Goal goal = behavior.getGoal(); Goal goal = behavior.getGoal();
if (Helper.mc.currentScreen instanceof GuiClick) { 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(); int thisPlayerDimension = behavior.baritone.getPlayerContext().world().getDimension().getType().getId();