home Forumsplay_arrow Minecraft fiber_manual_record Redstone

5

Command block - help combine two commands

5 emeralds14 replies310 views
created 02/10/2018 6:46 am by EmpathyHeals
last reply 03/09/2018 1:30 pm
I have a few exchanges on my server where a player tosses in an item to get something else. At one place I have a clunky redstone converter that takes in 16 enderpearls and gives back a "hug," which is a lilypad with custom name and lore. Another redstone converter takes in 16 rotten flesh and gives back a "kiss," which is a fern with custom name and lore. Somewhere else players can toss in these hugs and kisses into a dispenser and get reward like enchanting books and other nice items.

I want to get rid of this big and slow redstone converters that give the custom hugs and kisses and replace it with something else. Unfortunately the Essential trade signs can't be loaded with custom items, just regular lilypads and ferns.

I went to a command block generator that helped me make commands to summon villagers, and allowed me to choose what players could sell and buy from the villager. This command, too, unfortunately, only allowed me to put in regular lilypads and ferns, and did not provide an option for me to customize the name and lore. I therefore have two set of commands, the first set for the hugs includes the command for the villager and the command to give me the hug, the lilypad with the custom name and lore. The second set of commands also includes the command for the villager and the command that gives me the kiss, the fern with the custom name and lore.

I could use some help combining these two set of commands so each villager gives out a hug or a kiss (and 16 bottles o'enchanting) as trade for the enderpearls or rotten flesh. Here is the pastebin of the commands https://pastebin.com/AzdssG1y and I will also paste them below.

If this can't be done, dones anyone know of a plugin that handles custom item in trades?

Thanks for any help!!
Emp

PS. I don't know much about command block commands so feel free to take out anything that's not needed, like the repair cost.

PPS. Oh, and my server is still 1.11.2, although I hope to upgrade over the next week or two. Feel free to help with commands that work in command blocks in both versions or just the 1.11.2 version I guess if the villager will work even after the upgrade.

PPPS. If you help please provide commands through pastebin link. For some reason forums tend to mess up formatting of commands that make them not work in the command blocks. I don't know if it's the case on PMC but I do know I've had trouble running commands copied off the Enjin forums.


Commands:

1) Hug villager Squeeze - Trade 16 Ender Pearls for 1 Hug (lilypad) and 16 bottles o'enchanting:

/summon villager ~-189.5 ~49 ~366.55 {Invulnerable:1,PersistenceRequired:1,NoAI:1,Rotation:[-0.2f,-117.4f],CustomName:Squeeze,Offers:{Recipes:[{buy:{id:waterlily,Count:1},buyB:{id:experience_bottle,Count:16},sell:{id:ender_pearl,Count:16},maxUses:9999999}]}}


/give empathyheals 111 1 {display:{Name:Hug,Lore:["A hug from Empathy.","Come play and learn on Empathy!","IP 162.220.63.5:25745"]},RepairCost:1000}



2) Kiss villager Pucker - Trade 16 Rotten Flesh for 1 Kiss (fern) and 16 bottles o'enchanting:

/summon villager ~-189.5 ~49 ~353.39 {Invulnerable:1,PersistenceRequired:1,NoAI:1,Rotation:[15f,-40f],CustomName:Pucker,Offers:{Recipes:[{buy:{id:tallgrass,Damage:2,Count:1},buyB:{id:experience_bottle,Count:16},sell:{id:rotten_flesh,Count:16},maxUses:9999999}]}}


/give empathyheals 31 1 2 {display:{Name:Kiss,Lore:["A kiss from Empathy.","Come play and learn on Empathy!","IP 162.220.63.5:25745"]},RepairCost:1000}
Posted by avatar
EmpathyHeals
Level 37 : Artisan Architect
107

14 replies

1
02/27/2018 1:49 pm
Level 37 Artisan Architect
EmpathyHeals
avatar
Hmm, these villagers worked well for a time and now Squeeze is constipated. He refuses to trade or give back the Endpearls a player put in the trade window. What's worse, I killed him using the minecraft:kill command and the new villager I spawned from the command block is a) refusing to trade too and b) holding 16 endpearls like the one who I killed. And will not let them be removed.

Here is a video clip, when I hold my mouse over the endpearls or exp or hugs I am clicking several times and nothing happens. Any help is appreciated to fix it.

gyazo.com/002f3f8e9d9bfa23f31529f8dbc0c143
1
03/09/2018 1:30 pm
Level 27 Expert Engineer
ShelLuser
avatar
Sorry for a late response. Been off the grid for a while due to work and other issues. Expect a PM later on too. But since we started this in public we also should see it through in public (for random readers).

Lemme check the video and think this through. A new villager should work.
4
02/10/2018 1:00 pm
Level 27 Expert Engineer
ShelLuser
avatar
And this is exactly why I'm not a fan of command generators. Most were set up by people who don't even realize how the whole thing works or they never bothered to keep it up to date. I really enjoyed reading this (it's much different from most other questions) so let's see how far we can take it.

First: this is perfectly possible, no worries. Second: this is also why I mentioned in my commands guide blog that the key to solving puzzles like these is to keep track of basics. In this case I suggest to check out the data values on villagers and work your way up from there. So just build the command in parts. For example: if you check then you'll notice buy:{} (TAG_Compound), the id being a String and... tag:{}, I quote: "Additional information about the item.". tag:{} is your key into customizing items within villager trades.

But no worries, I'm also going to give this a decent try :) I read your comment about the commands, I'll double check my message afterwards to ensure that they will work after copying.

I am a little confused about the trades though. 16 rotten flesh for one kiss, but where are the bottles of enchanting coming in? See, you make it sound as if you get 2 items for one trade, but that's not how this works. At best you get to offer two items for one item in return.

So this is what I'm doing: trade 16 ender pearls + 16 bottles o'enchanting for 1 Hug. Then: trade 16 rotten flesh + 16 bottles o'enchanting for 1 Kiss.

I think I got it: one villager ('Squeeze') gives either 1 Hug or 16 bottles of enchanting in exchange for 16 ender pearls. The other villager ('Pucker') gives 1 Kiss or 16 bottles of enchanting in exchange for 16 rotten flesh.

If this turns out to be wrong just let me know, then we can change it (I'll save the commands in my redstone world for now).

I hope you don't mind but I want to add a little more than just the answer to this. Maybe a useful tip: what I always do when creating these commands (by using that wiki page I linked to) is to simply open a text editor (like notepad, or metapad, etc.) and then just typing out the command in "parts". You'll always know that the command requires an opening and a closing. For example: Offers:{} (open and closing bracket), Trades: [{buy:{},sell:{}}] all opening and closing stuff. I usually type it out as shown here, and then fill in the contents later. So I place the opening and closing on a different line and start typing.

Oh, I would suggest leaving AI on. If you set it up right you don't have to worry about their trades changing and from my experience it can be more fun because they will also look at you and such. But that's your choice. I'll just copy your setup (noai & rotation) for now.

Squeeze - 16 ender pearls gives either 1 Hug or 16 bottles o'enchanting. So first I start by typing out the command structure. I know we'll have 2 trades, I'm going to make this a farmer and set his trades to maximum so that no vanilla trades can slip in. So:

summon minecraft:villager ~ ~1 ~ {
CustomName:"Squeeze",Invulnerable:1,PersistenceRequired:1,Profession:0,Career:1,CareerLevel:6,Offers:{Recipes:[
{buy:{},buyB:{},sell:{}},
{buy:{},buyB:{},sell:{}}
]}
}

(this is without the AI and rotation as you can see, it's just to give an impression of how I'd start building commands like these).

Also: always type out your names. Don't use id:rotten_flesh because that is going to go bad some day. Spell it out: id:"minecraft:rotten_flesh".

So here is Squeeze:

summon minecraft:villager ~ ~1 ~ {CustomName:"Squeeze",Invulnerable:1,PersistenceRequired:1,Profession:0,Career:1,CareerLevel:6,Offers:{Recipes:[{buy:{id:"minecraft:ender_pearl",Count:16},sell:{id:"minecraft:experience_bottle",Count:16}},{buy:{id:"minecraft:ender_pearl",Count:16},sell:{id:"minecraft:waterlily",Count:1,tag:{display:{Name:"Hug",Lore:"A hug from Empathy.","Come play and learn on Empathy!","IP 162.220.63.5:25745"]}}}}]}}

And here we have Pucker (I like that name, it's funny), I made him a Priest so that he's different from Squeeze:

summon minecraft:villager ~ ~1 ~ {CustomName:"Pucker",Invulnerable:1,PersistenceRequired:1,Profession:2,Career:1,CareerLevel:6,Offers:{Recipes:[{buy:{id:"minecraft:rotten_flesh",Count:16},sell:{id:"minecraft:experience_bottle",Count:16}},{buy:{id:"minecraft:ender_pearl",Count:16},sell:{id:"minecraft:tallgrass",Damage:2,Count:1,tag:{display:{Name:"Kiss",Lore:"A kiss from Empathy.","Come play and learn on Empathy!","IP 162.220.63.5:25745"]}}}}]}}

So far, so good. This is basically what you asked for I think.

But....

May I suggest something a bit more out of the ordinary? Why not make those custom items look more customized?

So I'm going to extract the items in a give command:

/give @p minecraft:waterlily 1 0 {display:{Name:"Hug",Lore:["A hug from Empathy.","Come play and learn on Empathy!","IP 162.220.63.5:25745"]}}

It is fun, but... also a bit "meh". Why not enchant it and make it a bit more special?

/give @p minecraft:waterlily 1 0 {ench:[{id:1,lvl:1}],HideFlags:1,display:{Name:"Hug",Lore:["A hug from Empathy.","Come play and learn on Empathy!","IP 162.220.63.5:25745"]}}

So, just add: "ench:[{id:1,lvl:1}],HideFlags:1" to the villager commands if you'd want this. Without the quotes of course and you can put it right in front of display:{}.

Hope this helps! If you upgrade your server to 1.12 then be sure to look into functions. Those can do even more cool stuff with this, it would easily allow you to add color codes to the Lore and name so that you get a really special customized item. Feel free to drop me a PM if you're interested in that, I'd be happy to give some hints on how to easily set it up.

Hope this helped!
3
02/10/2018 10:18 pm
Level 37 Artisan Architect
EmpathyHeals
avatar
Wow thank you so much SheLuster, not only for the commands but for the tutorial! That's great, love to also learn something! I just returned to this and saw your reply and wanted to send a quick thank you. I am going to look though it more thoroughly and try the commands now. Just a few quick things:

I was told to put the AI off as otherwise it may roam around or leave the area and I didn't want the villager to go far. But if all it would do is look at you but not go anywhere then I will leave it on.

Also, I did originally want the villagers to give either one hug or kiss *and* bottles o'enchanting, but I think a hug or kiss *or* bottles o'enchanting might be best. The stuff in the exchanges changes over time and sometimes people may or may not want to exhange the hugs and kisses for what's in them. This way they also have a chance to get exp which is always useful. But, this is also something I can tweak over time, like lower the amount of exp or add another item.

I will try to add the enchants. Looks fun. What I'm not sure of is whether the exchange that takes in hugs and kisses to give other stuff will still take them. Some players already have hugs and kisses from the redstone converters and I would hate to make them obsolete. If the exchange does take them then I would not mind having them enchanted. Will test.

Thanks!!
Emp
2
02/10/2018 11:41 pm
Level 27 Expert Engineer
ShelLuser
avatar
Happy to help!

One thing though: you're right that leaving AI intact will make them walk around. I usually seal them in a bit which prevents that. And yeah, you can't get 2 rewards. You can only sell 2 items (buy:{} & buyB:{}) for one reward (sell:{}). Hope it works out, if not then just let us know.
4
02/10/2018 1:07 pm
Level 27 Expert Engineer
ShelLuser
avatar
As promised I copy/pasted my commands to test and I see what you mean. Weird. So here's the paste you asked for: pastebin.com/kgp5E3fi
3
02/10/2018 1:13 pm
Level 2 Apprentice Architect
Boxic
avatar
I'm not the OP, but props to you for laying all this out for them, pretty cool of you.

Search

Browse

Site

© 2010 - 2018
planetminecraft.com

Welcome