cabaletta / cabaletta/baritone

java.lang.IllegalAccessError: tried to access field net.minecraft.util.math.Vec3i.field_177962_a

Open
#3,859 14 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: MacOS (M1)
Java version: Java 8
Minecraft version: 1.12.2
Baritone version: 1.2.17 (I had this issue before updating to the unoptimized jar, & it's still an issue with the unoptimized version)
Other mods (if used): Lambda, Journeymap, rusherhack (if needed, I can reproduce with just Lambda)

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

Crash log

```
---- Minecraft Crash Report ----

WARNING: coremods are present:
LambdaCoreMod (lambda-1059.jar)
RusherHack-Loader (rusherhack-loader.jar)
Contact their authors BEFORE contacting forge

// You're mean.

Time: 3/2/23 11:45 AM
Description: Unexpected error

java.lang.IllegalAccessError: tried to access field net.minecraft.util.math.Vec3i.field_177962_a from class com.lambda.flute.BaritoneSelection
at com.lambda.flute.BaritoneSelection.min(BaritoneSelection.kt:21)
at com.lambda.flute.BaritoneSelection.aabb(BaritoneSelection.kt:35)
at baritone.eg.onRenderPass(Unknown Source)
at baritone.br.a(Unknown Source)
at java.util.concurrent.CopyOnWriteArrayList.forEach(CopyOnWriteArrayList.java:890)
at baritone.br.onRenderPass(Unknown Source)
at net.minecraft.client.renderer.EntityRenderer.handler$zdm000$renderWorldPass(EntityRenderer.java)
at net.minecraft.client.renderer.EntityRenderer.func_175068_a(EntityRenderer.java:1434)
at net.minecraft.client.renderer.EntityRenderer.func_78471_a(EntityRenderer.java:1259)
at net.minecraft.client.renderer.EntityRenderer.func_181560_a(EntityRenderer.java:1062)
at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:1119)
at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:398)
at net.minecraft.client.main.Main.main(SourceFile:123)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Thread: Client thread
Stacktrace:
at com.lambda.flute.BaritoneSelection.min(BaritoneSelection.kt:21)
at com.lambda.flute.BaritoneSelection.aabb(BaritoneSelection.kt:35)
at baritone.eg.onRenderPass(Unknown Source)
at baritone.br.a(Unknown Source)
at java.util.concurrent.CopyOnWriteArrayList.forEach(CopyOnWriteArrayList.java:890)
at baritone.br.onRenderPass(Unknown Source)
at net.minecraft.client.renderer.EntityRenderer.handler$zdm000$renderWorldPass(EntityRenderer.java)
at net.minecraft.client.renderer.EntityRenderer.func_175068_a(EntityRenderer.java:1434)
at net.minecraft.client.renderer.EntityRenderer.func_78471_a(EntityRenderer.java:1259)

-- Affected level --
Details:
Level name: MpServer
All players: 1 total; [EntityPlayerSP['PoTheMagicDragon'/21, l='MpServer', x=-7.50, y=85.00, z=-18.57]]
Chunk stats: MultiplayerChunkCache: 812, 812
Level seed: 0
Level generator: ID 00 - default, ver 1. Features enabled: false
Level generator options:
Level spawn location: World: (13,106,544828), Chunk: (at 13,6,12 in 0,34051; contains blocks 0,0,544816 to 15,255,544831), Region: (0,1064; contains chunks 0,34048 to 31,34079, blocks 0,0,544768 to 511,255,545279)
Level time: 811372 game time, 594771 day time
Level dimension: 0
Level storage version: 0x00000 - Unknown?
Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)
Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false
Forced entities: 23 total; [EntityPlayerSP['PoTheMagicDragon'/21, l='MpServer', x=-7.50, y=85.00, z=-18.57], EntityChicken['Chicken'/135, l='MpServer', x=-15.44, y=68.00, z=-45.73], EntitySheep['Sheep'/138, l='MpServer', x=68.64, y=71.00, z=-28.77], EntityWolf['Wolf'/139, l='MpServer', x=2.44, y=66.00, z=-43.52], EntitySheep['Sheep'/107, l='MpServer', x=63.79, y=69.00, z=47.49], EntityWolf['Wolf'/108, l='MpServer', x=-41.59, y=69.00, z=-70.39], EntityChicken['Chicken'/111, l='MpServer', x=-28.12, y=68.00, z=15.40], EntityItem['item.item.egg'/112, l='MpServer', x=-27.73, y=68.00, z=15.64], EntityItem['item.item.egg'/176, l='MpServer', x=33.68, y=74.00, z=6.90], EntityChicken['Chicken'/113, l='MpServer', x=1.40, y=72.00, z=46.12], EntityChicken['Chicken'/114, l='MpServer', x=-9.19, y=67.00, z=55.43], EntityChicken['Chicken'/116, l='MpServer', x=-3.90, y=68.00, z=59.23], EntitySheep['Sheep'/149, l='MpServer', x=70.25, y=67.00, z=39.18], EntitySheep['Sheep'/119, l='MpServer', x=67.81, y=77.00, z=-52.50], EntitySheep['Sheep'/151, l='MpServer', x=61.83, y=68.00, z=35.18], EntityChicken['Chicken'/120, l='MpServer', x=-9.58, y=68.00, z=35.50], EntityChicken['Chicken'/122, l='MpServer', x=34.50, y=74.00, z=6.14], EntitySheep['Sheep'/90, l='MpServer', x=23.24, y=68.00, z=-98.52], EntityWolf['Wolf'/123, l='MpServer', x=23.50, y=75.00, z=-0.91], EntityItem['item.item.egg'/124, l='MpServer', x=-15.75, y=65.00, z=38.72], EntityChicken['Chicken'/93, l='MpServer', x=-58.19, y=65.00, z=-18.48], EntityItem['item.item.egg'/94, l='MpServer', x=-57.64, y=65.00, z=-18.04], EntityWolf['Wolf'/95, l='MpServer', x=-26.73, y=69.00, z=-48.73]]
Retry entities: 0 total; []
Server brand: fml,forge
Server type: Integrated singleplayer server
Stacktrace:
at net.minecraft.client.multiplayer.WorldClient.func_72914_a(WorldClient.java:420)
at net.minecraft.client.Minecraft.func_71396_d(Minecraft.java:2741)
at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:427)
at net.minecraft.client.main.Main.main(SourceFile:123)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

-- System Details --
Details:
Minecraft Version: 1.12.2
Operating System: Mac OS X (x86_64) version 10.16
Java Version: 1.8.0_74, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
Memory: 1328401656 bytes (1266 MB) / 1894252544 bytes (1806 MB) up to 3817865216 bytes (3641 MB)
JVM Flags: 2 total; -Xmx4096m -Xms256m
IntCache: cache: 0, tcache: 0, allocated: 12, tallocated: 94
FML: MCP 9.42 Powered by Forge 14.23.5.2860 7 mods loaded, 7 mods active
States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored

| State | ID | Version | Source | Signature |
|:------ |:---------- |:------------ |:----------------------------- |:---------------------------------------- |
| LCHIJA | minecraft | 1.12.2 | minecraft.jar | None |
| LCHIJA | mcp | 9.42 | minecraft.jar | None |
| LCHIJA | FML | 8.0.99.99 | forge-1.12.2-14.23.5.2860.jar | e3c3d50c7c986df74c645c0ac54639741c90a557 |
| LCHIJA | forge | 14.23.5.2860 | forge-1.12.2-14.23.5.2860.jar | e3c3d50c7c986df74c645c0ac54639741c90a557 |
| LCHIJA | journeymap | 1.12.2-5.7.1 | journeymap-1.12.2-5.7.1.jar | None |
| LCHIJA | lambda | 3.3.0 | lambda-1059.jar | None |
| LCHIJA | rusherhack | 1.3 | rusherhack-loader.jar | None |

Loaded coremods (and transformers):
LambdaCoreMod (lambda-1059.jar)

RusherHack-Loader (rusherhack-loader.jar)

GL info: ' Vendor: 'Apple' Version: '2.1 Metal - 83' Renderer: 'Apple M1 Pro'
Launched Version: forge-14.23.5.2860
LWJGL: 2.9.2
OpenGL: Apple M1 Pro GL version 2.1 Metal - 83, Apple
GL Caps: Using GL 1.3 multitexturing.
Using GL 1.3 texture combiners.
Using framebuffer objects because ARB_framebuffer_object is supported and separate blending is supported.
Shaders are available because OpenGL 2.1 is supported.
VBOs are available because OpenGL 1.5 is supported.

Using VBOs: Yes
Is Modded: Definitely; Client brand changed to 'fml,forge'
Type: Client (map_client.txt)
Resource Packs: Dramatic Skys Demo 1.5.3.2.zip (incompatible), Default-Dark-Mode-1.12-v1.4.0.zip, SCC_flowing_water.zip
Current Language: English (US)
Profiler Position: N/A (disabled)
CPU: 10x Apple M1 Pro
```

## How to reproduce

### The Short version
Making a call to `Selection(BetterBlockPos pos1, BetterBlockPos pos2)` makes things go boom.

I'm guessing you could make this happen by creating a vanilla mod & making a call to the function, but I don't know enough about vanilla mods to test that out.

(the longer version is below the details)
### Some more details
This seems like it's related to [this issue](https://github.com/cabaletta/baritone/issues/2865)

- The error message is identical & the stack trace is identical (up until the obfuscated code part)
- At one point, I was also having issues with `#click` crashing my game, but that no longer seems to be an issue.
- The click functionality also calls Selection(pos1, pos2) (well, it calls `BaritoneAPI.getProvider().getPrimaryBaritone().getSelectionManager().addSelection(` which calls it, but same thing)

identical portion of stack trace

```
java.lang.IllegalAccessError: tried to access field net.minecraft.util.math.Vec3i.field_177962_a from class ...Some Class name...
... Obfuscated baritone code....
at java.util.concurrent.CopyOnWriteArrayList.forEach(CopyOnWriteArrayList.java:890)
at baritone.hi.a(Unknown Source)
at net.minecraft.client.renderer.EntityRenderer.handler$renderWorldPass$zzf000(EntityRenderer.java)
at net.minecraft.client.renderer.EntityRenderer.func_175068_a(EntityRenderer.java:1434)
at net.minecraft.client.renderer.EntityRenderer.func_78471_a(EntityRenderer.java:1259)
at net.minecraft.client.renderer.EntityRenderer.func_181560_a(EntityRenderer.java:1062)
at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:1119)
at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:398)
at net.minecraft.client.main.Main.main(SourceFile:123)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
```

### The long version
I'm developing a plugin for lambda & as a part of that I am making multiple selections. I tried to do this awhile ago & failed assuming it was an issue with obfuscated jars, but after updating lambda to use the unoptimized jar, and still having the issue I started digging deeper.

Anytime I make a call to create a selection using `Selection(pos1, pos2)` the process crashes. (Not the game, just the current lambda process)

To figure out what was happening I made a copy of that class, used intellij to convert it to kotlin, renamed it & ran it again with the copy to make sure I was still having the issue (I was) & then I then started picking it apart (commenting out code, restructuring things, etc). I eventually narrowed down the crash to the following:
Kotlin:
`private val min = BetterBlockPos(kotlin.math.min(pos1.x, pos2.x), kotlin.math.min(pos1.y, pos2.y), kotlin.math.min(pos1.z, pos2.z))`
Java:
`this.min = new BetterBlockPos(Math.min(pos1.x, pos2.x), Math.min(pos1.y, pos2.y), Math.min(pos1.z, pos2.z));`
Then I moved that statement from the initializer to the getter function & I was finally able to get the error included above.

Here's the final Kotlin class to go with the error log above:

BaritoneSelection.kt

```kotlin
package com.lambda.flute

import baritone.api.selection.ISelection
import baritone.api.utils.BetterBlockPos
import net.minecraft.util.EnumFacing
import net.minecraft.util.math.AxisAlignedBB
import net.minecraft.util.math.Vec3i

class BaritoneSelection(private val pos1: BetterBlockPos, private val pos2: BetterBlockPos) : ISelection {

override fun pos1(): BetterBlockPos {
return pos1
}

override fun pos2(): BetterBlockPos {
return pos2
}

override fun min(): BetterBlockPos { //crash happened on the next line
return BetterBlockPos(kotlin.math.min(pos1.x, pos2.x), kotlin.math.min(pos1.y, pos2.y), kotlin.math.min(pos1.z, pos2.z))
}

override fun max(): BetterBlockPos {
return BetterBlockPos(kotlin.math.max(pos1.x, pos2.x), kotlin.math.max(pos1.y, pos2.y), kotlin.math.max(pos1.z, pos2.z))
}

override fun size(): Vec3i {
val min = min()
val max = max()
return Vec3i(max.x - min.x + 1, max.y - min.y + 1, max.z - min.z + 1)
}

override fun aabb(): AxisAlignedBB {
val min = min()
val max = max()
return AxisAlignedBB(min, max.add(1, 1, 1))
}

override fun hashCode(): Int {
return pos1.hashCode() xor pos2.hashCode()
}

override fun toString(): String {
return String.format("Selection{pos1=%s,pos2=%s}", pos1, pos2)
}

private fun isPos2(facing: EnumFacing): Boolean {
val negative = facing.axisDirection.offset < 0
return when (facing.axis) {
EnumFacing.Axis.X -> (pos2.x > pos1.x) xor negative
EnumFacing.Axis.Y -> (pos2.y > pos1.y) xor negative
EnumFacing.Axis.Z -> (pos2.z > pos1.z) xor negative
else -> throw IllegalStateException("Bad EnumFacing.Axis")
}
}

override fun expand(direction: EnumFacing, blocks: Int): ISelection {
return if (isPos2(direction)) BaritoneSelection(pos1, pos2.offset(direction, blocks)) else BaritoneSelection(pos1.offset(direction, blocks), pos2)
}

override fun contract(direction: EnumFacing, blocks: Int): ISelection {
return if (isPos2(direction)) BaritoneSelection(pos1.offset(direction, blocks), pos2) else BaritoneSelection(pos1, pos2.offset(direction, blocks))
}

override fun shift(direction: EnumFacing, blocks: Int): ISelection {
return BaritoneSelection(pos1.offset(direction, blocks), pos2.offset(direction, blocks))
}

override fun equals(other: Any?): Boolean {
if (this === other) return true
if (javaClass != other?.javaClass) return false

other as BaritoneSelection

if (pos1 != other.pos1) return false
if (pos2 != other.pos2) return false
if (min() != other.min()) return false
if (max() != other.max()) return false
if (size() != other.size()) return false
if (aabb() != other.aabb()) return false

return true
}
}
```

## Modified settings
None

## 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.