BlockDispenseEvent is called twice since 26.3 for most blocks
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 55/100
Línea de trabajo
Start in DispenserBlock around line 121 and trace SulfurCubeBlockDispenseItemBehavior.execute into dispenseBlock and CraftEventFactory.handleBlockDispenseEvent. Check how the fallback through DefaultDispenseItemBehavior triggers the event, then reproduce with an event listener that logs each dispense. Done means one BlockDispenseEvent per dispense, with the sulfur cube behavior and fallback still working.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Expected behavior
BlockDispenseEvent is only called once when a dispenser throws out a block
Observed/Actual behavior
When a block is dispensed from a dispenser, it used to go through the usual DefaultDispenseItemBehavior.
With the Sulfur Cubes that changed for most blocks (DispenserBlock line 121):
} else if (itemStack.is(ItemTags.SULFUR_CUBE_SWALLOWABLE)) {
return SulfurCubeBlockDispenseItemBehavior.INSTANCE;
}
SulfurCubeBlockDispenseItemBehavior#execute (vanilla) falls back to super.execute if no Sulfur Cube took the item:
@Override
protected ItemStack execute(final BlockSource source, final ItemStack dispensed) {
return dispenseBlock(source.level(), source.pos().relative(source.state().getValue(DispenserBlock.FACING)), dispensed, source, this) // Paper - Call BlockDispenseEvent
? dispensed
: super.execute(source, dispensed);
}
Paper calls handleBlockDispenseEvent at the start of dispenseBlock, before it checks whether a Sulfur Cube is in front:
ItemStack result = org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockDispenseEvent(source, pos, dispensed, currentBehavior);
If there is none, dispenseBlock returns false and vanilla falls back to super.execute, which fires the event again in DefaultDispenseItemBehavior.spawnItem.
The same applies to TNT: the TNT behavior also calls SulfurCubeBlockDispenseItemBehavior.dispenseBlock first and then fires its own BlockDispenseEvent. The TNT is only primed once, but the event is called twice for a single dispense.
sequenceDiagram
autonumber
participant D as DispenserBlock
participant S as SulfurCubeBlockDispenseItemBehavior
participant DD as DefaultDispenseItemBehavior (super)
participant F as CraftEventFactory
participant L as Plugin Listener
D->>D: getDefaultDispenseMethod(itemStack)
Note over D: itemStack.is(SULFUR_CUBE_SWALLOWABLE)<br/>→ SulfurCubeBlockDispenseItemBehavior.INSTANCE
D->>S: dispense(source, stack)
S->>S: execute(source, stack)
S->>S: dispenseBlock(level, pos, stack, source, this)
S->>F: handleBlockDispenseEvent(source, pos, stack, this)
F->>L: BlockDispenseEvent (1st call)
L-->>F: not cancelled
F-->>S: null
S->>S: getEntitiesOfClass(SulfurCube, AABB(pos))
Note over S: no Sulfur Cube in front<br/>→ dispenseBlock returns false
S->>DD: super.execute(source, stack)
DD->>DD: spawnItem(level, stack, 6, direction, position, source)
DD->>L: BlockDispenseEvent (2nd call)
L-->>DD: not cancelled
DD->>DD: level.addFreshEntity(itemEntity)
Steps/models to reproduce
Watch the BlockDispenseEvent with a event listener and see two logs for the same dispense.
Plugin and Datapack List
Paper version
This server is running Paper version 26.3-209-main@03af8b4 (2026-10-20T21:49:44Z) (Implementing API version 26.3.build.209-stable)
Other
No response
- Lenguaje dominante
- Java
- Estrellas
- 12.8k
- Forks
- 3.6k
- Merge medio
- 4 d 22 h
- PR fusionados (30 d)
- 46
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de PaperMC/Paper
-
status: needs triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
PaperMC/Paper#14375 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
Add .getIgniter() to ExplosiveMinecartPosiblemente ocupada @WouterGritter la tomó hace 40 días. Abiertostatus: needs triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
PaperMC/Paper#14097 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
BlockType#isOccluding is incorrectly handledPosiblemente ocupada @ryoji-ikeda la tomó hace 184 días. Abiertostatus: accepted
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
PaperMC/Paper#13790 · 5 comentarios ·
Los mantenedores suelen responder en 1 día
-
status: needs triage version: 26.3
Dificultad 3/5 1-2 días Aptitud para principiantes 55/100
Los mantenedores suelen responder en 1 día
-
status: needs triage version: 26.3
Dificultad 3/5 1-2 días Aptitud para principiantes 72/100
PaperMC/Paper#14412 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
Todos los issues de PaperMC/Paper
Issues similares
-
agent:working bug follow-up lane:auto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Sanne/incus-spawn#1765 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
checkstyle/checkstyle#22260 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
strimzi/strimzi-kafka-operator#13328 · 1 comentario · 3 reacciones ·
Los mantenedores suelen responder en 1 día