Mod is currently not working with modded items/blocks after first load. A fix is being worked on!
What
Block-Item Tweaker is a straightforward utility for modpacks that allows to assign any arbitrary block to an arbitrary item by configuring their relation in a reloadable JSON. It effectively merges both, so that when you "place" the item, the block will be placed.
Block-items can be defined to be placed by right-clicking and shift-right-clicking (vanilla behavior) or ony when shift-right-clicking (useful for items with right-click uses)
Do note you will have to manually tweak the drops of the block to drop back the item with a mod like Dropt or CraftTweaker.
Why
What can you do with this? Well, you will have to create the blocks yourself with another mod (ContentTweaker, Content Creator, BBLSOhMy, etc) or think of existing relations that make sense, but to give an example, placeable vanilla sticks, bowls, paper, books, etc, etc. Just asign a block to them.
How
Go to config\blockitemtweaker.json or create the file if it doesn't exist, then define the item:block relationship. Below is a ready-to-test example.
Use command /blockitemtweaker reload to test your changes in-game
{
"normal": {
"minecraft:stick": "minecraft:planks",
"minecraft:coal": {
"block": "minecraft:stained_glass",
"mode": "direct",
"state": {
"color": "red"
}
},
"minecraft:coal:1": {
"block": "minecraft:stonebrick",
"mode": "set_item",
"meta": 0
},
"minecraft:dye": "minecraft:wool",
"minecraft:golden_apple": {
"block": "minecraft:wool",
"mode": "set_item"
}
},
"sneaking": {
"minecraft:coal": {
"block": "minecraft:stained_glass",
"mode": "direct",
"state": {
"color": "green"
}
},
"minecraft:iron_ingot": "minecraft:iron_block"
}
}
Item metadata is definided directly on the item key; block meta/state must be defined in the dedicated fields.
Entries have a "mode" field, which can be "direct", "held_item", or "set_item". This is to solve the problem of some block placement logic possibly requiring the player to be actually holding a stack of the block.
-
the default if not defined is "held_item" mode, which just uses the specified item
-
in "set_item" mode, it'll temporarily change the player's held item to the block, try to do the placement, then change it back to whatever the original item was
-
in "direct" mode, it directly sets the block in the world without going through the normal block item logic (particularly useful for placing blocks that don't have associated items, like fire)
Do note this mod's placement bypasses the forge block placement events, which means other mods might not be able to tell that the player placed the blocks; a potentiual issue with e.g. claim protection mods and the like.
Who
Graciously coded in its entirety by phantamanta44
Idea and logo by Foreck

