PaperMC / PaperMC/Paper

Event for when a dispenser creates entities

Open
#13,302 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: accepted
Dominant language
Java
Stars
12.7k
Forks
3.5k
Avg merge
3d 13h
Merged PRs (30d)
11

Description

Is your feature request related to a problem?

I want to be able to track the owner of a minecart for a protection plugin. If the dispenser has an owner, it should be transferred over to the minecart as well. For this, I need access to the dispenser and minecart simultaneously, which is currently not straightforward.

Describe the solution you'd like.

Either an extension of BlockDispenseEvent (akin to BlockDispenseArmorEvent) that contains an entity or a new event (as was proposed in https://github.com/PaperMC/Paper/pull/10669 and https://github.com/PaperMC/Paper/pull/7377)

Describe alternatives you've considered.

Listen to BlockDispenseEvent, check if the item is Material.MINECART, Material.CHEST_MINECART, Material.FURNACE_MINECART, Material.TNT_MINECART, Material.HOPPER_MINECART, or Material.COMMAND_BLOCK_MINECART, take the velocity vector and reinterpret it as a location (because despite saying it's a velocity vector, it's actually a location coordinate) and store it, listen to VehicleCreateEvent during the same tick, check if the spawned vehicle's location matches the velocity vector and assume it's the same one (because there are no spawn reasons)

Other

Prior work on this issue has been done in https://github.com/PaperMC/Paper/pull/10669 and https://github.com/PaperMC/Paper/pull/7377

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review BlockDispenseEvent, BlockDispenseArmorEvent, and VehicleCreateEvent to understand the existing event boundaries. Then read the approaches in pull requests 10669 and 7377; the work is done when a dispenser-created minecart event exposes both the dispenser and entity for owner tracking.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.