Add NBT to dropped items
Tedyhere opened this issue ยท 8 comments
Is it possible to add NBT tags? I am needing to add forestry princess drops from leaves and just can't find a good way to do it.
https://pastebin.com/00FZtMZy Is the NBT tag for a generic Meadows Princess...
Ok, I think I've found a way to do this. Minecraft provides a class to deserialize NBT tags from strings, however, the syntax is not the same as the syntax that you gave (which I assume is from something like a /ct hand
output). What I will do is introduce a new command /dropt hand
which will produce a string, display it in the chat console and copy it to the clipboard. This string can then be pasted right into the json file. The string will contain the serialized nbt if there is an nbt tag.
I expect to have this feature available within 48 hours.
Ok, the /dropt hand
command is working.
minecraft:enchanted_book:0#{StoredEnchantments:[{lvl:4s,id:4s}]}
Oooooh, that is awesome.. once again AMAZING work on your mods. So thankful to have modders like you that really help out us pack makers
Thank you for the kind words. :)
Ok, everything seems in order.
Tested with script:
{
"rules": [
{
"match": {
"blocks": {
"blocks": [
"minecraft:stone"
]
},
"harvester": {
"heldItemMainHand": {
"items": [
"minecraft:wooden_pickaxe:*"
]
}
}
},
"drops": [
{
"item": {
"items": [
"minecraft:enchanted_book:0#{StoredEnchantments:[{lvl:4s,id:4s}]}",
"minecraft:wooden_pickaxe:0#{RepairCost:0,display:{Name:\"Test#Name#Wheee!{}\"}}"
]
}
}
]
}
]
}
The /dropt hand
command will escape quotes for you. If you do find any special characters or special circumstances that break the serialization / deserialization, don't hesitate to open a new issue. Thanks!
Going to push a new build now.
Feature available in 1.12.2-1.6.5
https://minecraft.curseforge.com/projects/dropt/files/2528748
I think this is a great idea.
Just so I understand correctly: the idea is to add NBT matching to items dropped by blocks?
The biggest hurdle implementing this feature will most likely be deserializing NBT from strings.
I'll look into this.
Thank you for using pastebin! That being said, I'm going to drop this here for quick reference later. (That's a gnarly tag)
<forestry:bee_princess_ge>.withTag({MaxH: 20, Mate: {Chromosomes: [{UID1: "forestry.speciesMeadows", UID0: "forestry.speciesMeadows", Slot: 0 as byte}, {UID1: "forestry.speedSlowest", UID0: "forestry.speedSlowest", Slot: 1 as byte}, {UID1: "forestry.lifespanShorter", UID0: "forestry.lifespanShorter", Slot: 2 as byte}, {UID1: "forestry.fertilityNormal", UID0: "forestry.fertilityNormal", Slot: 3 as byte}, {UID1: "forestry.toleranceNone", UID0: "forestry.toleranceNone", Slot: 4 as byte}, {UID1: "forestry.boolFalse", UID0: "forestry.boolFalse", Slot: 5 as byte}, {UID1: "forestry.toleranceNone", UID0: "forestry.toleranceNone", Slot: 6 as byte}, {UID1: "forestry.boolFalse", UID0: "forestry.boolFalse", Slot: 7 as byte}, {UID1: "forestry.boolFalse", UID0: "forestry.boolFalse", Slot: 8 as byte}, {UID1: "forestry.flowersVanilla", UID0: "forestry.flowersVanilla", Slot: 9 as byte}, {UID1: "forestry.floweringSlower", UID0: "forestry.floweringSlower", Slot: 10 as byte}, {UID1: "forestry.territoryAverage", UID0: "forestry.territoryAverage", Slot: 11 as byte}, {UID1: "forestry.effectNone", UID0: "forestry.effectNone", Slot: 12 as byte}]}, Health: 20, IsAnalyzed: 0 as byte, Genome: {Chromosomes: [{UID1: "forestry.speciesMeadows", UID0: "forestry.speciesMeadows", Slot: 0 as byte}, {UID1: "forestry.speedSlowest", UID0: "forestry.speedSlowest", Slot: 1 as byte}, {UID1: "forestry.lifespanShorter", UID0: "forestry.lifespanShorter", Slot: 2 as byte}, {UID1: "forestry.fertilityNormal", UID0: "forestry.fertilityNormal", Slot: 3 as byte}, {UID1: "forestry.toleranceNone", UID0: "forestry.toleranceNone", Slot: 4 as byte}, {UID1: "forestry.boolFalse", UID0: "forestry.boolFalse", Slot: 5 as byte}, {UID1: "forestry.toleranceNone", UID0: "forestry.toleranceNone", Slot: 6 as byte}, {UID1: "forestry.boolFalse", UID0: "forestry.boolFalse", Slot: 7 as byte}, {UID1: "forestry.boolFalse", UID0: "forestry.boolFalse", Slot: 8 as byte}, {UID1: "forestry.flowersVanilla", UID0: "forestry.flowersVanilla", Slot: 9 as byte}, {UID1: "forestry.floweringSlower", UID0: "forestry.floweringSlower", Slot: 10 as byte}, {UID1: "forestry.territoryAverage", UID0: "forestry.territoryAverage", Slot: 11 as byte}, {UID1: "forestry.effectNone", UID0: "forestry.effectNone", Slot: 12 as byte}]}})