Jump to content

Adding Items To Armor Slots???


perigrine3

Recommended Posts

So I'm not exactly an avid modder or coder. I get the basics (at least I think so :/), but I've been having a problem with this one project that I've been working on... 

Typically, for simplicity, I use MCreator so I don't have to spend hours and hours working on my projects. I could potentially learn how to code JavaScript for Minecraft, but I don't think I could figure it out. Anyways, my project is a mod for the show on Netflix, Trollhunters. I've created a lot of the items already, and soon, I plan to create the mobs (Trolls, Merlin, Gum Gums, etc). I found another Trollhunters mod, but it sucked because the person who made it just threw the amulet, sword, and armor into MCreator and called it quits. I'm NOT going to do that. I've been going into MCreator and tweaking the precompiled code to make each of the parts work exactly how I want them to. However, I'm stuck on this one thing with the Amulet of Daylight. 

So for those of you who don't know the show, when the character, Jim Lake, says the magic words, "For the glory of Merlin, Daylight is mine to command!", the magic armor appears on his body, along with the Daylight sword in his hand.

My problem is with that. I want to set it up so that when the player presses 'M', the armor appears in their armor slots, along with the Daylight sword in the handheld slots, and the Amulet should disappear from their inventory too. So, I already have the 'M'-key-pressed-action-thing set up, I just need some help with the code to make the armor appear in the inventory.

I've been looking through the internet and I can't seem to find anything that works. Everybody is talking in huge code terms and I have no clue what any of those words mean until I actually look at the code and make some sort of sense of it. I just need some sort of method to add the armor to the correct armor slots. I don't know too much about coding JavaScript, so please try to keep it simple and describe what each part does so I can learn something from this. 

 

Thank you for your help (If you do in fact help)! 

 

(P.S: I will be sure to credit you in some way if you do help, be it easter eggs or straight up crediting. Also, you never know if this mod will get big, so just consider that before you leave this page... ) 

Link to comment
Share on other sites

Not even if I can find ways around that? I know what you're talking about, with the locked code; I've seen that, but I can get a Java Developing software and just open the compiled mod with that and then change it in there. And if push comes to shove, I'll just copy each class into a new mod file so that I can edit it, because I'm dedicated to figuring this out. So seriously; any tips as to how to add armor directly into the armor slots?

You mentioned that pre-made code. Does that mean I'd have to change something in that to make this work? Please just give me some answers here. I NEED HELP, INTERNET! 

Link to comment
Share on other sites

MCreator owns any code you made with it. You are not legally allowed to use it in any other project.

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

1. MCreator is terrible. Learn Java. Getting started is not exactly that hard, and the process is very rewarding.

2. Read my favorite StackOverflow post: https://stackoverflow.com/questions/245062/whats-the-difference-between-javascript-and-java

  • Like 1

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

Link to comment
Share on other sites

Okay, I GET IT, but can someone just tell me HOW TO ADD AN ITEM INTO ARMOR SLOTS??? THAT'S ALL I WANT TO KNOW!!!!!!!!!!!!!!!!!!!!!!! 

I feel like you're all just saying the same thing here! Probably because you ARE! 

I get it!!!! You all hate MCreator! Now tell me what I need to know!!!!!!!!!!!!!!!!!!!

Link to comment
Share on other sites

You're saying the equivalent of “Build me an airplane then I’ll go and learn how to build one myself”.

On 2/17/2019 at 9:38 AM, diesieben07 said:

If you want to make mods, you need to learn Java.

That information is

14 minutes ago, perigrine3 said:

what I need to know!!!!!!!!!!!!!!!!!!!

 

 

14 minutes ago, perigrine3 said:

HOW TO ADD AN ITEM INTO ARMOR SLOTS?

Get the armor slot index and call

Minecraft.getInstance().player.inventory.armorInventory.set(armorIndex, itemStack);

Note: Minecraft.getInstance and everything else from that snippet is from 1.13 mappings. Names may not be the same in your version (Minecraft.getInstance is Minecraft.getMinecraft on <1.13)

Edited by Cadiboo
  • Thanks 1

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

2 hours ago, perigrine3 said:

Also, if you guys help me, I can finish this project and begin learning to code Java. 

You are basically asking "Make a mod, and I will put my name on it".

You cannot make a mod without knowing how to code in Java.

LEARN JAVA.

 

2 hours ago, perigrine3 said:

You all hate MCreator!

Yes. MCreator is hated by the majority of the modding community due to its crappy generated code and its limitations.

To be honest, you can't really make an original mod with MCreator. All mods made with MCreator are essentially the same mod with different textures and names, as the capability of MCreator is very limited.

 

Read: https://gist.github.com/davidmaamoaix/53482c153a18f598e9cd96538fa6f58e

Edited by DavidM

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

Link to comment
Share on other sites

3 minutes ago, DavidM said:

Put it on GitHub gist. No ones going to download a random text file (and people on mobile can’t)

Edited by Cadiboo
“test”->”text”

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

There is no license attached so I am not certain whether I have permission to move it to a gist.

Found the license. I do have permission:

https://gist.github.com/davidmaamoaix/53482c153a18f598e9cd96538fa6f58e

Edited by DavidM

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

Link to comment
Share on other sites

Thank you Cabidoo! 

19 minutes ago, Cadiboo said:

Get the armor slot index and call


Minecraft.getInstance().player.inventory.armorInventory.set(armorIndex, itemStack);

Also, I see what you're saying: 

17 minutes ago, Cadiboo said:

“Build me an airplane then I’ll go and learn how to build one myself”.

but that's actually how I work. I look at things other people have made, and I take it apart and put it back together. By doing so, I learn something about it. I do that with everything in life. What I was saying is that, if you build me this thing that I'm asking for, I can learn something from it. 

 

I understand the gist of coding. I have learned AppleScript, I am learning JavaScript, and I am learning Twine (even though that doesn't really count as a coding language because it's like MCreator for JavaScript, but it does require a level of coding so I'm including it). I'm not COMPLETELY stupid. 

I didn't think of it that way, DavidM, I suppose you are right. 

16 minutes ago, DavidM said:

To be honest, you can't really make an original mod with MCreator. All mods made with MCreator are essentially the same mod with different textures and names, as the capability of MCreator is very limited.

However, I did make this awesome mod for a weapon that you can throw and teleport to with a keybind, at which point it is returned to your inventory. WITH MCREATOR. I made it have a spin cycle while it flies through the air, and I got it to work smoothly (for the most part :/ ) over the course of two years. I think it really just depends on who's using MCreator, and whether their creative or not. But I'm sure you're going to keep arguing with me, so I don't know why I bother. 

 

Anyways, I WILL go learn Java, I was just trying to make this mod as quickly as possible for my little brother and sister to play because we all love that show and Minecraft, so I told them I would make both of them a mod for it. I'm just a sucker for details, so I wanted this to work as I saw it in my head. 

 

Thank you for giving me an answer Cabidoo. I am going to play with that and see if I can get this b**** to work. 

 

Also, if you want to try a sample of that mod I was talking about, I'm going to attach it. 

Even though I doubt anybody will actually try it... 

Image result for dwight the office

TeleBlade Sample Mod.jar

Link to comment
Share on other sites

1 hour ago, perigrine3 said:

over the course of two years.

Wow. I must say, apart from everything else, that you do have a lot of free time, which I do envy ?.

Edited by DavidM

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

Link to comment
Share on other sites

Lol, not really. I suck at focusing on the things I probably SHOULD be doing instead. 

So, I've been at it for a while, but I honestly don't know how to get the armor slot index like Cadiboo said to. 

 

Rn, all I have is 

Minecraft.getMinecraft().player.inventory.armorInventory.set(armorIndex, itemStack); 

but idk which access modifiers to use, or what "get" thing to use to get the armor slot index. 

 

I think I have a basic idea of what that means; it's calling for it, but idk how to DO that... :3 

 

Help...?

Link to comment
Share on other sites

14 hours ago, perigrine3 said:

Minecraft.getMinecraft().player.inventory.armorInventory.set(armorIndex, itemStack); 

- Where are you calling this? This gets the player on the client, and therefore will not work in multiplayer. Get the player from the appropriate event/parameter of the method/wherever you are using that line.

 

- Armor index [0, 3] is:

3: Helmet

2: Chestplate

1: Leggings

0: Boots

So if you want to set something to the leggings part, do

player.inventory.armorInventory.set(2, itemStack);

 

Edited by DavidM
  • Thanks 1

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

Link to comment
Share on other sites

Inside an OnKeyInput event. I don't need multiplayer. 

 

I know there needs to be some sort of function command before I put "player.inventory.armorInventory..." though, right? Like an access modifier and then something like that "OnKeyInput" thing. It's in the code as: 

 

    public void onKeyInput(InputEvent.KeyInputEvent event)

and then brackets after that, which is where I'm putting the 

Minecraft.getMinecraft().player.inventory.armorInventory.set(armorIndex, itemStack); 

Link to comment
Share on other sites

1. The armor slot index is an int. Pass an int corresponding to the armor slot you want to change.

18 minutes ago, DavidM said:

0: Helmet

1: Chestplate

2: Leggings

3: Boots

 

2. Yes, put it in the event. You might want to check the key of the event though.

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

Link to comment
Share on other sites

Why do I want to check the key of the event? I set it to 'M'. Like double check it you mean? 

 

HOLY S*** I THINK I JUST GOT IT!!! THE CODE RETURNED WITHOUT ERRORS!!! 

Image result for im so excited gif

I just have to test in in Minecraft now to see if it actually does what I want, but I think I got it! 

 

It's been so long since I came up without errors. :C

Image result for its been 84 years gif

Link to comment
Share on other sites

12 hours ago, DavidM said:

0: Helmet

1: Chestplate

2: Leggings

3: Boots

I'm 90% sure its the other way round

  • Thanks 1

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Link to comment
Share on other sites

1 hour ago, Cadiboo said:

I'm 90% sure its the other way round

Oops. I'm sorry.

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.