Skip to content

DepotBehaviourMixin's setSpecialTransportedItemStack NPEs when the wrapped item is null #128

Description

@computerfreaq09

Describe the bug

Calling Create's DepotBehaviour.setHeldItem(null) crashes the client with a NullPointerException. Your @WrapOperation mixin (compat.create.DepotBehaviourMixin, method petrolpark$setSpecialTransportedItemStack) reads newItem.stack unconditionally before calling through to the wrapped operation, without checking whether newItem is null first.

Vanilla Create's own setHeldItem is a plain field assignment with no null-check:

public void setHeldItem(TransportedItemStack heldItem) {
    this.heldItem = heldItem;
}

Create even has a separate removeHeldItem() that explicitly sets this same field to null, so null appears to be a valid/expected value here in Create's own design - the mixin adds a stricter requirement that isn't part of the wrapped method's actual contract.

I verified this reproduces with every other addon mod removed (including all MCreator-built mods), so it isn't an addon-interaction issue - it's triggered here by Create: Ratatouille's "Spreader Breed" Ponder scene (SpreaderBreedScene.java:90), which calls setHeldItem with what ends up being a null item in this context. Since vanilla Create tolerates null for this field, I believe the bug is the missing null-check in this mixin, not anything Ratatouille is doing wrong.

To Reproduce

  1. Have Petrolpark's Library + Create: Ratatouille both installed (NeoForge 1.21.1)
  2. Open JEI and view the recipe for Spreader Breeding (or otherwise trigger Ratatouille's "Spreader Breed" Ponder scene)
  3. Client crashes with the following shortly after the scene starts playing:
java.lang.NullPointerException: Cannot read field "stack" because "newItem" is null
	at com.simibubi.create.content.logistics.depot.DepotBehaviour.wrapMethod$goo000$petrolpark$setSpecialTransportedItemStack(DepotBehaviour.java:1049)
	at com.simibubi.create.content.logistics.depot.DepotBehaviour.setHeldItem(DepotBehaviour.java)
	at org.forsteri.ratatouille.ponder.SpreaderBreedScene.lambda$spreader_breed$3(SpreaderBreedScene.java:90)
	at net.createmod.ponder.foundation.PonderSceneBuilder$PonderWorldInstructions.lambda$modifyBlockEntity$20(PonderSceneBuilder.java:638)
	at net.createmod.ponder.foundation.instruction.PonderInstruction$Simple.tick(PonderInstruction.java:42)
	at net.createmod.ponder.foundation.PonderScene.tick(PonderScene.java:313)
	at net.createmod.ponder.foundation.ui.PonderUI.tick(PonderUI.java:474)

Expected Behavior

The Ponder scene should play normally without crashing the client, the same way it does without Petrolpark's Library installed.

Screenshots

N/A - crash happens before anything visibly wrong renders, just the crash screen itself.

System Information

  • Petrolpark's Library 1.5.0 (latest available, confirmed before reporting)
  • Minecraft 1.21.1, NeoForge
  • Other mods and their versions: Create 6.0.10, Create: Ratatouille 1.4.0 (latest available - triggering mod), Ponder for KubeJS 2.4.0
  • No Optifine, no MCreator mods present - reproduced this crash with every MCreator-built mod (and anything depending on them) temporarily removed to confirm it isn't an addon-interaction issue

Additional context

Confirmed no existing report for this on this tracker before filing.

For crashes, include the crash report and debug.log.
[ATTACH: crash report + debug.log from the reproduction - both timestamped 2026-07-26 ~07:58]

Minecraft Username

computerfreaq09

crash-2026-07-26_07.58.39-client.txt

debug.log

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐛 BugSomething isn't working as intended

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions