WIP: Creative pickblock functionality (fixes #197) #4552

Draft
rudzik8 wants to merge 19 commits from pickblock into master
Member

According to Minecraft Wiki:

The player can obtain items using pick block (defaults to middle click on mouse). Unlike Survival, the block selected appears in the player's hotbar even if the block is not already in the hotbar or in the Survival inventory. If it is in the inventory, then the block moves out of its former slot and replaces the block/item in the active hotbar slot, with the size of the stack preserved. If the hotbar is full then the selected block replaces the block/item in the active slot.

Most blocks give the player a copy of themselves when using pick block. Using it on an item frame gives the player the item held inside, or the item frame itself if no item is held. Using it on a mob gives the player a spawn egg of that mob. Using it on a mob head gives the mob type that it is; using it on custom heads gives only the mob type that was used in the command, but without the custom skin.

If the player holds Control and presses pick block, in addition to obtaining the item, it also preserves the block's NBT tags, allowing the player to place an identical copy of the block; this allows the player to duplicate items inside of chests, dispensers, and so on, and also duplicates the text on signs.

Assigning actions to middle-click is impossible in MTE as of 5.9.1, so pickblock functionality is bound to the place key with a bare hand.

  • Basic pointed node pickblock
  • Don't pick nodes that are 'illegal' (not_in_creative_inventory ~= 0)
  • Allow 'illegal' nodes to have a pickblock alias (_vl_pickblock field of node def)
  • Notify the player if a node they're trying to pick is already in their hotbar
    NOTE: As of 5.8.1, MTE doesn't provide an API to change player's selected hotbar slot.
  • Mobs pickblock functionality
  • Mob head pickblock functionality
  • Patch our mods to support pickblock aliases
    • mcl_beds
    • mcl_beehives
    • mcl_brewing
    • mcl_cocoas
    • mcl_chests
    • mcl_doors
    • mcl_farming
    • mcl_flowers
    • mcl_mangrove
    • mcl_ocean
    • mcl_stairs
    • more?

Testing

  1. Load a creative world.
  2. Try picking a block while not holding anything (right-click).
  3. Try picking an 'illegal' block this way (like wheat plant).
  4. Try picking an 'illegal' block that has a pickblock alias (like kelp on sand).
  5. Try picking a block that is already in your hotbar (but on a different slot than your selected one, of course).
According to [Minecraft Wiki](https://minecraft.wiki/w/Creative#Pick_block): > The player can obtain items using *pick block* (defaults to middle click on mouse). Unlike Survival, the block selected appears in the player's hotbar even if the block is not already in the hotbar or in the Survival inventory. If it is in the inventory, then the block moves out of its former slot and replaces the block/item in the active hotbar slot, with the size of the stack preserved. If the hotbar is full then the selected block replaces the block/item in the active slot. > > Most blocks give the player a copy of themselves when using *pick block*. Using it on an item frame gives the player the item held inside, or the item frame itself if no item is held. Using it on a mob gives the player a spawn egg of that mob. Using it on a [mob head](https://minecraft.wiki/w/Mob_head) gives the mob type that it is; using it on custom heads gives only the mob type that was used in the [command](https://minecraft.wiki/w/Command), but without the custom skin. > > If the player holds Control and presses *pick block*, in addition to obtaining the item, it also preserves the block's [NBT tags](https://minecraft.wiki/w/NBT_format), allowing the player to place an identical copy of the block; this allows the player to duplicate items inside of chests, dispensers, and so on, and also duplicates the text on [signs](https://minecraft.wiki/w/Sign). Assigning actions to middle-click is impossible in MTE as of 5.9.1, so pickblock functionality is bound to the place key with a bare hand. - [x] [Basic pointed node pickblock](https://content.minetest.net/packages/ROllerozxa/pickblock/) - [x] Don't pick nodes that are 'illegal' (`not_in_creative_inventory ~= 0`) - [x] Allow 'illegal' nodes to have a pickblock alias (`_vl_pickblock` field of node def) - [x] Notify the player if a node they're trying to pick is already in their hotbar _NOTE: As of 5.8.1, MTE doesn't provide an API to change player's selected hotbar slot._ - [ ] Mobs pickblock functionality - [ ] Mob head pickblock functionality - [x] Patch our mods to support pickblock aliases - [x] `mcl_beds` - [x] `mcl_beehives` - [x] `mcl_brewing` - [x] `mcl_cocoas` - [ ] `mcl_chests` - [x] `mcl_doors` - [x] `mcl_farming` - [x] `mcl_flowers` - [x] `mcl_mangrove` - [x] `mcl_ocean` - [x] `mcl_stairs` - more? ### Testing 1. Load a creative world. 2. Try picking a block while not holding anything (right-click). 3. Try picking an 'illegal' block this way (like wheat plant). 4. Try picking an 'illegal' block that has a pickblock alias (like kelp on sand). 5. Try picking a block that is already in your hotbar (but on a different slot than your selected one, of course).
rudzik8 added the
nodes
creative mode
labels 2024-08-01 04:59:27 +02:00
rudzik8 added 12 commits 2024-08-01 04:59:28 +02:00
Contributor

Nothing happens for:

  • bee nests having honey: one (without honey?) should be given.
  • slab_*_double: one slab should be given
  • flower pots with anything in them: should give an empty one
  • hanging_propagule: should give a propagule
  • sea pickle: should give one

Would be nice to give:

  • 1 cocoa bean when right-clicking their pods
  • 1 seed when right-clicking crops
Nothing happens for: - bee nests having honey: one *(without honey?)* should be given. - slab_*_double: one slab should be given - flower pots with anything in them: should give an empty one - hanging_propagule: should give a propagule - sea pickle: should give one Would be nice to give: - 1 cocoa bean when right-clicking their pods - 1 seed when right-clicking crops
rudzik8 changed title from WIP: Creative pickblock functionality to WIP: Creative pickblock functionality (fixes #197) 2024-08-01 07:02:54 +02:00

Wait, we could have that control+pick lock (aux1 + pickblock?) by creating an itemstack from meta of the node, right...?

Wait, we could have that control+pick lock (aux1 + pickblock?) by creating an itemstack from meta of the node, right...?
First-time contributor

Make sure it works with item frames as well. Besides, wouldn't it been better idea to do a shortcut key for this?

Make sure it works with item frames as well. Besides, wouldn't it been better idea to do a shortcut key for this?
Contributor

Minetest comes with a fixed set of controls, so we can only use those.

Minetest comes with a fixed set of controls, so we can only use those.
rudzik8 added 1 commit 2024-08-03 08:45:11 +02:00
rudzik8 added 1 commit 2024-08-03 08:57:44 +02:00
rudzik8 added 1 commit 2024-08-03 09:06:26 +02:00
Author
Member
  • flower pots with anything in them: should give an empty one

Nothing happens with empty flowerpots too. They have an on_rightclick function, and that is logically prioritized over pickblock. That will require more than just a patch with a few one-liners, and I'm afraid I can't afford to do that in this PR, or else it will just become too cluttered.

> * flower pots with anything in them: should give an empty one Nothing happens with empty flowerpots too. They have an `on_rightclick` function, and that is logically prioritized over pickblock. That will require more than just a patch with a few one-liners, and I'm afraid I can't afford to do that in this PR, or else it will just become too cluttered.
rudzik8 added 1 commit 2024-08-03 09:13:39 +02:00
rudzik8 added 1 commit 2024-08-03 09:16:14 +02:00
rudzik8 added 1 commit 2024-08-03 09:25:58 +02:00
rudzik8 added 1 commit 2024-08-03 09:28:51 +02:00

What if you utilize the zoom key? It's not like it's doing anything with empty hand, and we're hijacking it anyway.

If not alone, then maybe as modifier... so if empty hand is placed, then first it's checked if zoom is pressed, and if it is, then run pickblock functionality and return.

What if you utilize the `zoom` key? It's not like it's doing anything with empty hand, and we're hijacking it anyway. If not alone, then maybe as modifier... so if empty hand is placed, then first it's checked if zoom is pressed, and if it is, then run pickblock functionality and return.
rudzik8 force-pushed pickblock from bd1f86fe4c to 271606cf27 2024-08-18 06:15:05 +02:00 Compare
This pull request is marked as a work in progress.
This branch is out-of-date with the base branch
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: VoxeLibre/VoxeLibre#4552
No description provided.