mojira.dev
MC-18495

Making a villager trade air gives a console error message

Whenever you change a villagers trade to air using NBT tag editing and open the trade the game crashes even if you don't trade. I used a mod to create the trade but the game will crash even without it on single player and multiplayer.


Steps to reproduce in 14w08a:

  • Place command block with

    summon Villager ~ ~-2 ~ {PersistenceRequired: 1,CustomName:Lever Game Champion,CustomNameVisible:1, Attributes:[{Name:generic.movementSpeed,Base:0}],Offers:{Recipes:[ {buy:{id:0},sell:{id:323,Count:1,tag:{display:{Name:Local Lever Game Champion,Lore:[Some day I will beat, the legendry Teep!]}}}}]}}
  • Pausing the game will yield an exception in the development console:

    [19:49:40 INFO]: Client> [19:49:40] [Server thread/INFO]: Saving chunks for level 'New World222'/Overworld
    [19:49:40 INFO]: Client> s: Saving entity NBT
    [19:49:40 INFO]: Client> 	at sk.e(SourceFile:1123)
    [19:49:40 INFO]: Client> 	at sk.d(SourceFile:1090)
    [19:49:40 INFO]: Client> 	at atc.a(SourceFile:210)
    [19:49:40 INFO]: Client> 	at atc.a(SourceFile:99)
    [19:49:40 INFO]: Client> 	at oa.b(SourceFile:161)
    [19:49:40 INFO]: Client> 	at oa.a(SourceFile:192)
    [19:49:40 INFO]: Client> 	at ob.a(SourceFile:663)
    [19:49:40 INFO]: Client> 	at net.minecraft.server.MinecraftServer.a(SourceFile:305)
    [19:49:40 INFO]: Client> 	at cby.v(SourceFile:124)
    [19:49:40 INFO]: Client> 	at net.minecraft.server.MinecraftServer.run(SourceFile:387)
    [19:49:40 INFO]: Client> 	at mr.run(SourceFile:657)
    [19:49:40 INFO]: Client> Caused by: java.lang.NullPointerException
    [19:49:40 INFO]: Client> 	at aik.j(SourceFile:114)
    [19:49:40 INFO]: Client> 	at ail.a(SourceFile:125)
    [19:49:40 INFO]: Client> 	at aai.b(SourceFile:206)
    [19:49:40 INFO]: Client> 	at sk.e(SourceFile:1111)
    [19:49:40 INFO]: Client> 	... 10 more
    [19:49:40 INFO]: Client> [19:49:40] [Server thread/INFO]: Saving chunks for level 'New World222'/Nether
    [19:49:40 INFO]: Client> [19:49:40] [Server thread/INFO]: Saving chunks for level 'New World222'/The End

Villagers apparently cannot buy air. Doesn't throw exceptions with

summon Villager ~ ~-2 ~ {PersistenceRequired: 1,CustomName:Lever Game Champion,CustomNameVisible:1, Attributes:[{Name:generic.movementSpeed,Base:0}],Offers:{Recipes:[ {buy:{id:1},sell:{id:323,Count:1,tag:{display:{Name:Local Lever Game Champion,Lore:[Some day I will beat, the legendry Teep!]}}}}]}}

Difference:

buy:{id:0}

-->

buy:{id:1}

Linked issues

Attachments

Comments 12

Incomplete without crash report. Please attach crash reports in the future to tickets about a crash.

It also crashes if you try to make them sell other invalid blocks, such as the technical blocks whose item forms were removed from 1.7, like placed cake. Those crashes happen when you pass the mouse over the blank spot where their picture should be. The moral of the story: don't make them sell invalid blocks.

Confirmed for

  • 14w31a

  • Minecraft 1.8-pre 1
    but without a crash

    Error

    u: Saving entity NBT
    	at wq.e(SourceFile:1134)
    	at wq.d(SourceFile:1092)
    	at bfa.a(SourceFile:242)
    	at bfa.a(SourceFile:113)
    	at qn.b(SourceFile:160)
    	at qn.a(SourceFile:203)
    	at qo.a(SourceFile:766)
    	at net.minecraft.server.MinecraftServer.a(SourceFile:359)
    	at net.minecraft.server.MinecraftServer.x(SourceFile:548)
    	at cxc.x(SourceFile:155)
    	at net.minecraft.server.MinecraftServer.run(SourceFile:446)
    	at java.lang.Thread.run(Unknown Source)
    Caused by: java.lang.NullPointerException
    	at app.k(SourceFile:129)
    	at apq.a(SourceFile:129)
    	at agf.b(SourceFile:217)
    	at wq.e(SourceFile:1122)
    	... 11 more

Present in 1.8.3.

Just tried this in 1.8.7, still crashes. Crash report is below

---- Minecraft Crash Report ----
// Uh... Did I do that?

Time: 27/06/15 22:00
Description: Updating screen events

java.lang.NullPointerException: Updating screen events
	at ya.h(SourceFile:159)
	at ya.a(SourceFile:90)
	at yg.d(SourceFile:81)
	at xi.a(SourceFile:239)
	at bda.a(SourceFile:368)
	at ayl.a(SourceFile:515)
	at ayl.b(SourceFile:486)
	at axu.k(SourceFile:419)
	at axu.p(SourceFile:390)
	at ave.s(SourceFile:1497)
	at ave.av(SourceFile:888)
	at ave.a(SourceFile:325)
	at net.minecraft.client.main.Main.main(SourceFile:124)


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

-- Head --
Stacktrace:
	at ya.h(SourceFile:159)
	at ya.a(SourceFile:90)
	at yg.d(SourceFile:81)
	at xi.a(SourceFile:239)
	at bda.a(SourceFile:368)
	at ayl.a(SourceFile:515)
	at ayl.b(SourceFile:486)
	at axu.k(SourceFile:419)
	at axu.p(SourceFile:390)

-- Affected screen --
Details:
	Screen name: azd

-- Affected level --
Details:
	Level name: MpServer
	All players: 1 total; [bew['DTaylorMedia'/0, l='MpServer', x=-9.25, y=6.00, z=-58.66]]
	Chunk stats: MultiplayerChunkCache: 287, 287
	Level seed: 0
	Level generator: ID 01 - flat, ver 0. Features enabled: false
	Level generator options: 
	Level spawn location: 0.00,1.00,0.00 - World: (0,1,0), Chunk: (at 0,0,0 in 0,0; contains blocks 0,0,0 to 15,255,15), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)
	Level time: 173472 game time, 6000 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: 2 total; [bew['DTaylorMedia'/0, l='MpServer', x=-9.25, y=6.00, z=-58.66], wi['Villager'/191748, l='MpServer', x=-10.50, y=6.00, z=-56.50]]
	Retry entities: 0 total; []
	Server brand: vanilla
	Server type: Integrated singleplayer server
Stacktrace:
	at bdb.a(SourceFile:309)
	at ave.b(SourceFile:2293)
	at ave.a(SourceFile:334)
	at net.minecraft.client.main.Main.main(SourceFile:124)

-- System Details --
Details:
	Minecraft Version: 1.8.7
	Operating System: Windows 7 (amd64) version 6.1
	CPU: 2x AMD Athlon(tm) II X2 270 Processor
	Java Version: 1.8.0_25, Oracle Corporation
	Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
	Memory: 111817824 bytes (106 MB) / 444080128 bytes (423 MB) up to 1060372480 bytes (1011 MB)
	JVM Flags: 6 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -Xmx1G -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:-UseAdaptiveSizePolicy -Xmn128M
	IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
	Launched Version: 1.8.7
	LWJGL: 2.9.4
	OpenGL: GeForce GT 630/PCIe/SSE2 GL version 4.4.0, NVIDIA Corporation
	GL Caps: Using GL 1.3 multitexturing.
Using GL 1.3 texture combiners.
Using framebuffer objects because OpenGL 3.0 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: No
	Is Modded: Probably not. Jar signature remains and client brand is untouched.
	Type: Client (map_client.txt)
	Resource Packs: [PureBDcraft 128x MC18.zip]
	Current Language: English (US)
	Profiler Position: N/A (disabled)
2 more comments

Relates to MC-36324, probably the result of a partwise fix

This bug happens in the public NBTTagCompound writeToTags() method of the net.minecraft.village.MerchantRecipe class (MCP 1.8 names). The reason for this is that the invalid item gets set as null which cannot be stored in a NBT tag. The villager seems to be the only affected entity and no tile entity is affected.

Grum please stop closing so many reports 😞
Based on MCP 1.8 Minecraft tests for every other situation where an ItemStack is saved, so why not here?

Try using mcedit to delete the villager.

In 17w06a and probably earlier versions there is no error anymore. Very likely because air was added as item and therefor the item is not null.

Jonathan Ivy

Erik Broes

Community Consensus

crash, trading, villager

Minecraft 1.5.1, Minecraft 1.5.2, Minecraft 14w21b, Minecraft 1.8, Minecraft 1.8.1, Minecraft 1.8.3, Minecraft 1.8.7, Minecraft 15w49b, Minecraft 1.8.9

Retrieved