cabaletta / cabaletta/baritone

Magma block detection not detectioning enough

Open
#4,834 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
9.2k
Forks
2.1k
Avg merge
4d 3h
Merged PRs (30d)
3

Description

## Some information
Operating system: N/A
Java version: N/A
Minecraft version: 1.19.4
Baritone version: Latest
Other mods (if used):

## Exception, error or logs
Please find your `latest.log` or `debug.log` in this folder and attach it to the issue
N/A

## How to reproduce
use allowWalkOnMagmaBlocks

## Modified settings
allowWalkOnMagmaBlocks true

## Explanation
\
So pretty recently, I merged a PR which allowed you to sneak over magma blocks, but I kinda implemented it all wrong. I mean, the change is pretty decent, but there are lots of times where it just fails. I implemented the change by checking if the player's hitbox intersected any magma blocks each tick. If it did, I made the player sneak. The issue with this is that it's not at all how the Minecraft code actually works. What Minecraft cares about is if the center of the player's hitbox touches a magma block, not just any point (this makes it different than campfires, which will hurt the player if any point of the hitbox intersects). The solution is unfortunately absurdly complicated. You need to make a copy of the player (smh ffs tspmo) with the next tick's keyboard inputs and run `tick` to get the player's `position` (or was it `deltaMovement` that you add to the `position` I forget) on the next tick. You then check run `getOnPosLegacy` (even though it's deprecated because Minecraft still uses that one) to get the `BlockPos` that you need to check to see if it's a magma block. If it is, sneak.

Oh and also `steppingOnBlocks` is dumb and uses WAY to much processing power. It should actually be like this:
```java
static boolean steppingOnBlock(IPlayerContext ctx, Block block) {
if (!ctx.player().isOnGround()) {
return false;
}
for (int x = (int)ctx.player().getBoundingBox().minX; x <= (int)ctx.player().getBoundingBox().maxX); x++ {
for (int z = (int)ctx.player().getBoundingBox().minZ; z <= (int)ctx.player().getBoundingBox().maxZ); z++ {
if (ctx.world().getBlockState(new BetterBlockPos(x, ctx.player().getBlockY() - 1, z)).is(block)) {
return true;
}
}
}
return false;
}
```
\

## Final checklist
- [x] I know how to properly use check boxes
- [x] I have included the version of Minecraft I'm running, baritone's version and forge mods (if used).
- [x] I have included logs, exceptions and / or steps to reproduce the issue.
- [x] I have not used any OwO's or UwU's in this issue.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.