Topic category: Advanced modding
Hello and welcome to my problem.
First of all my english isn't very good.(i hope you can understand it)
I wanted to make a "block" that can be "right klicked" and if the player right klicks it a Shop GUI would pop up.
In this gui is a button called "Sell".If the player press it a Item should be removed from his inventory in this case a Steel Bar (Mod item).
After the Player sold it he should get Money (in this case 10 Mineys) (Mineys is called the money in my mod).
But here the problem come.
First of all here is the "code"
It should consume the "Steel Bar" and after this it should give the Player 1 money.
After the player recieved the money the player shouldn be able to press the button again if he has no "Steel Bars" left in his inventory.
Here's a Video of the Problem.
https://www.youtube.com/watch?v=bQoNIppH0II&feature=youtu.be
I cant fix it on my own cus i dont have much skills in coding etc...
Help would be nice :)
Ok so click create events and then select stack events and before you add it, there is a white box above it. Press the arrow and select hasPlayerInInventory[item/block]. Press stack event and press add item to inventory. This will check if it has the item and give the money. But then you need to get rid of the item as they recieve money so...
Add another event where it removes 1 item. If you do anything higher than 1 there will be a bug where you can get money from 1 item instead of 2+ items.
First of all thank you very much.It works now but not really like it should.The player now can sell stuff but there is a wierd bug.I cant explain it in words so take a look here.I have no idea how to fix it :/
https://youtu.be/GmM9X_QWkYs
This bug I am not sure about. It seems to be a bug with either minecraft or mcreator.
I am not the only one witht that bug THANK fk :) I been getting that same problem tried remaking the mod, tried redownloading everyting, yep I get this very same problem when using the GUI also at times I get the ghost item of 0 size, MCreator at times just can't cut it.
@#4 I can't finish my mod when this thing dosent work :/ So let's wait for the new update and hope ! :)
The best thing to do is to report the bug and hopefully it will be fixed.
i would add an Input Slot, and make it detect if an iron ingot is inside the slot, then it takes one, and gives you your Miney, i could try and recreate this in MCreator and take a pic for you
Or Steel Ingot in your mod, i added iron ingot for my 1st thing as thats what i would have used.
@#7 Hmm good idea i will try it :) Would be very cool if you could take a pic :)
MrExo, i know you wanted a GUI, but i managed to recreate something like how you wanted using a block, basically, you make a block, but on Block Rightclicked, make 2 events, 1 giving the item, and one taking the item, AKA: Giving 1 Emerald and Selling 1 Steel Bar, its the best i could do, but its something