mojira.dev
MC-6141

Enderman NBT Data sign bit error

The issue is that enderman cannot carry blocks with id larger then 127, the block will not render and the game will crash when they try to swap the block again.

They WILL carry any block with id under 127.

All tests where done using the emerald block (id 133).

It first happened when I was creating a bukkit plugin that edited the carried and carriedData NBT tags for the enderman, I was able to spawn them but, as said before, the block did not render and the server crashed when one of these enderman tried to pick another block.

Then I edited some more enderman (with emerald block) and closed the server before they picked any other block, then after loading the map on single player and waiting a few seconds, one of the enderman picked a block and the game crashed.

It seems that as the block id is internally saved as byte it is not properly converted to int when using it as a index of the "material array".....
It keeps the sign bit and messes up the integer sign, probably there is a missing " int idAsInteger = (idAsByte & 0xFF); " somewhere on the code.
This is suported by the fact that the Exception is ArrayIndexOutOfBoundsException and the index is -123.
-123 is the same as 133 (emerald block) when using the last by as sign (two's complement)

The same may occur for carriedData (not tested)

Crash reports below!

Attachments

Comments 10

Enderman aren't supposed to carry those blocks. See the wiki for the blocks that they are supposed to carry.

Your making them do something unintended.

@Xavier Brown, You are right they by default all blocks carried by enderman are with id under 127. But i still think that they are not working right. If they would have programmed enderman to pick up emerald blocks by default it would have crashed the game. This does not affect the normal user but is an inconsistency in the code.

It might affect adventure maps.

I just tested it and, yes, it's still present on 1.5, just updated the affected versions...

Confirmed on release 1.5.2.

Still happens in 1.6.2, just updated using a new crash report!

Description: Ticking entity

java.lang.ArrayIndexOutOfBoundsException: -123
	at adr.a(SourceFile:47)
	at adq.a(SourceFile:365)
	at abv.f(SourceFile:306)
	at tf.c(SourceFile:158)
	at oe.l_(SourceFile:1176)
	at of.l_(SourceFile:169)
	at tl.l_(SourceFile:29)
	at abv.a(SourceFile:1349)
	at jr.a(SourceFile:479)
	at abv.g(SourceFile:1327)
	at abv.h(SourceFile:1234)
	at jr.h(SourceFile:364)
	at net.minecraft.server.MinecraftServer.t(SourceFile:470)
	at net.minecraft.server.MinecraftServer.s(SourceFile:405)
	at bkw.s(SourceFile:124)
	at net.minecraft.server.MinecraftServer.run(SourceFile:339)
	at hh.run(SourceFile:582)

Is this still a concern in the current Minecraft version 1.7.2 / Launcher version 1.3.4 ? If so, please update the affected versions in order to best aid Mojang ensuring bugs are still valid in the latest releases/pre-releases.

This ticket is incomplete without the requested information, no response has been received within a reasonable time and we are assuming the issue has been resolved. If you are still experiencing this issue, we can reopen it at your request.
Please review the guidelines before reporting issues.

Gonçalo Baltazar

(Unassigned)

Unconfirmed

NBT, enderman

Minecraft 1.4.6, Minecraft 1.4.7, Minecraft 1.5, Minecraft 1.6.1, Minecraft 1.6.2

Retrieved