Jump to content

How do you spawn items 1.16


Arealcoder

Recommended Posts

im not talking about spawning mods items.

I want to make a mod that spawns a item.

I'm making a block that mines blocks but right now you cant get the blocks it has ben mined

I could use invtorys but I want to be simple so I want to spawn items on top of the block instead.

Link to comment
Share on other sites

20 minutes ago, Arealcoder said:

im not talking about spawning mods items.

I want to make a mod that spawns a item.

I'm making a block that mines blocks but right now you cant get the blocks it has ben mined

I could use invtorys but I want to be simple so I want to spawn items on top of the block instead.

create a new ItemEntity and and it to the world

Link to comment
Share on other sites

5 hours ago, Luis_ST said:

create a new ItemEntity and and it to the world

It's easier to use InventoryHelper#spawnItemStack

also note that BlockPos stand for the bottom corner of the block, you need to properly offset the spawning position

Link to comment
Share on other sites

7 hours ago, Arealcoder said:

I'm making a block that mines blocks but right now you cant get the blocks it has ben mined

Within the method that performs the mining action you can find a list of ItemEntities mined with getEntitiesWithinAABB() of the block's position, and filter to only find dirt, stone, etc. Once you have the entities you can teleport them to the block position above the mining block with teleportTo() or something similar.

Edited by urbanxx001
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.