Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 606e9bf97c | |||
| 47ae75a9d6 | |||
| 25587e317a | |||
| b3ba129fc5 | |||
| 746b7b5c88 | |||
| db2f6ec78d |
+2
-2
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
group 'baritone'
|
group 'baritone'
|
||||||
version '1.5.0'
|
version '1.5.1'
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
@@ -82,7 +82,7 @@ task sourceJar(type: Jar, dependsOn: classes) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
minecraft {
|
minecraft {
|
||||||
mappings channel: 'snapshot', version: '20200205-1.15.1'
|
mappings channel: 'snapshot', version: '20200213-1.15.1'
|
||||||
reobfMappings 'notch'
|
reobfMappings 'notch'
|
||||||
|
|
||||||
runs {
|
runs {
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,5 +29,5 @@ public abstract class MixinScreen implements IGuiScreen {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Invoker("openLink")
|
@Invoker("openLink")
|
||||||
public abstract void openLink(URI url);
|
public abstract void openLinkInvoker(URI url);
|
||||||
}
|
}
|
||||||
|
|||||||
+13
-15
@@ -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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -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"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -100,7 +100,7 @@ public class BaritoneChatControl implements Helper, AbstractGameEventListener {
|
|||||||
return false;
|
return false;
|
||||||
} else if (msg.trim().equalsIgnoreCase("orderpizza")) {
|
} else if (msg.trim().equalsIgnoreCase("orderpizza")) {
|
||||||
try {
|
try {
|
||||||
((IGuiScreen) mc.currentScreen).openLink(new URI("https://www.dominos.com/en/pages/order/"));
|
((IGuiScreen) mc.currentScreen).openLinkInvoker(new URI("https://www.dominos.com/en/pages/order/"));
|
||||||
} catch (NullPointerException | URISyntaxException ignored) {}
|
} catch (NullPointerException | URISyntaxException ignored) {}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -295,7 +295,7 @@ public interface MovementHelper extends ActionCosts, Helper {
|
|||||||
*/
|
*/
|
||||||
static boolean canWalkOn(BlockStateInterface bsi, int x, int y, int z, BlockState state) {
|
static boolean canWalkOn(BlockStateInterface bsi, int x, int y, int z, BlockState state) {
|
||||||
Block block = state.getBlock();
|
Block block = state.getBlock();
|
||||||
if (block instanceof AirBlock || block == Blocks.MAGMA_BLOCK || block == Blocks.BUBBLE_COLUMN) {
|
if (block instanceof AirBlock || block == Blocks.MAGMA_BLOCK || block == Blocks.BUBBLE_COLUMN || block == Blocks.HONEY_BLOCK) {
|
||||||
// early return for most common case (air)
|
// early return for most common case (air)
|
||||||
// plus magma, which is a normal cube but it hurts you
|
// plus magma, which is a normal cube but it hurts you
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -110,9 +110,9 @@ 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().getPositionMatrix().copy();
|
this.projectionViewMatrix = projectionMatrix.copy();
|
||||||
this.projectionViewMatrix.multiply(modelViewStack.getLast().getPositionMatrix());
|
this.projectionViewMatrix.mul(modelViewStack.getLast().getMatrix());
|
||||||
this.projectionViewMatrix.invert();
|
this.projectionViewMatrix.invert();
|
||||||
|
|
||||||
if (currentMouseOver != null) {
|
if (currentMouseOver != null) {
|
||||||
@@ -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;
|
||||||
|
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ public interface IRenderer {
|
|||||||
static void drawAABB(MatrixStack stack, AxisAlignedBB aabb) {
|
static void drawAABB(MatrixStack stack, AxisAlignedBB aabb) {
|
||||||
AxisAlignedBB toDraw = aabb.offset(-renderManager.renderPosX(), -renderManager.renderPosY(), -renderManager.renderPosZ());
|
AxisAlignedBB toDraw = aabb.offset(-renderManager.renderPosX(), -renderManager.renderPosY(), -renderManager.renderPosZ());
|
||||||
|
|
||||||
Matrix4f matrix4f = stack.getLast().getPositionMatrix();
|
Matrix4f matrix4f = stack.getLast().getMatrix();
|
||||||
buffer.begin(GL_LINES, DefaultVertexFormats.POSITION);
|
buffer.begin(GL_LINES, DefaultVertexFormats.POSITION);
|
||||||
// bottom
|
// bottom
|
||||||
buffer.pos(matrix4f, (float) toDraw.minX, (float) toDraw.minY, (float) toDraw.minZ).endVertex();
|
buffer.pos(matrix4f, (float) toDraw.minX, (float) toDraw.minY, (float) toDraw.minZ).endVertex();
|
||||||
|
|||||||
@@ -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();
|
||||||
@@ -181,7 +181,7 @@ public final class PathRenderer implements IRenderer, Helper {
|
|||||||
|
|
||||||
|
|
||||||
public static void drawLine(MatrixStack stack, double x1, double y1, double z1, double x2, double y2, double z2) {
|
public static void drawLine(MatrixStack stack, double x1, double y1, double z1, double x2, double y2, double z2) {
|
||||||
Matrix4f matrix4f = stack.getLast().getPositionMatrix();
|
Matrix4f matrix4f = stack.getLast().getMatrix();
|
||||||
|
|
||||||
double vpX = posX();
|
double vpX = posX();
|
||||||
double vpY = posY();
|
double vpY = posY();
|
||||||
@@ -319,7 +319,7 @@ public final class PathRenderer implements IRenderer, Helper {
|
|||||||
renderHorizontalQuad(stack, minX, maxX, minZ, maxZ, y1);
|
renderHorizontalQuad(stack, minX, maxX, minZ, maxZ, y1);
|
||||||
renderHorizontalQuad(stack, minX, maxX, minZ, maxZ, y2);
|
renderHorizontalQuad(stack, minX, maxX, minZ, maxZ, y2);
|
||||||
|
|
||||||
Matrix4f matrix4f = stack.getLast().getPositionMatrix();
|
Matrix4f matrix4f = stack.getLast().getMatrix();
|
||||||
buffer.begin(GL_LINES, DefaultVertexFormats.POSITION);
|
buffer.begin(GL_LINES, DefaultVertexFormats.POSITION);
|
||||||
buffer.pos(matrix4f, (float) minX, (float) minY, (float) minZ).endVertex();
|
buffer.pos(matrix4f, (float) minX, (float) minY, (float) minZ).endVertex();
|
||||||
buffer.pos(matrix4f, (float) minX, (float) maxY, (float) minZ).endVertex();
|
buffer.pos(matrix4f, (float) minX, (float) maxY, (float) minZ).endVertex();
|
||||||
@@ -336,7 +336,7 @@ public final class PathRenderer implements IRenderer, Helper {
|
|||||||
|
|
||||||
private static void renderHorizontalQuad(MatrixStack stack, double minX, double maxX, double minZ, double maxZ, double y) {
|
private static void renderHorizontalQuad(MatrixStack stack, double minX, double maxX, double minZ, double maxZ, double y) {
|
||||||
if (y != 0) {
|
if (y != 0) {
|
||||||
Matrix4f matrix4f = stack.getLast().getPositionMatrix();
|
Matrix4f matrix4f = stack.getLast().getMatrix();
|
||||||
buffer.begin(GL_LINE_LOOP, DefaultVertexFormats.POSITION);
|
buffer.begin(GL_LINE_LOOP, DefaultVertexFormats.POSITION);
|
||||||
buffer.pos(matrix4f, (float) minX, (float) y, (float) minZ).endVertex();
|
buffer.pos(matrix4f, (float) minX, (float) y, (float) minZ).endVertex();
|
||||||
buffer.pos(matrix4f, (float) maxX, (float) y, (float) minZ).endVertex();
|
buffer.pos(matrix4f, (float) maxX, (float) y, (float) minZ).endVertex();
|
||||||
|
|||||||
@@ -21,5 +21,5 @@ import java.net.URI;
|
|||||||
|
|
||||||
public interface IGuiScreen {
|
public interface IGuiScreen {
|
||||||
|
|
||||||
void openLink(URI url);
|
void openLinkInvoker(URI url);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user