Jump to content

Recommended Posts

Posted

I am wanting to give the armour in my mod special properties, but I have no idea how to do so.

 

For the first armour set I want it to be the case that when the full set is worn it has the properties of a carved pumpkin, making it so you won't aggravate endermen when you look at them. 

 

The second, and presumably harder property is that for the second set I would like it to be the case that when the full set is worn, you can walk over the void without falling. (I was considering using the levitation to accomplish this but I wanted to check beforehand).

 

Would both of these specialities be achievable for each armour set and how exactly would they both be done? Help would be much appreciated. 

Posted (edited)

The thought process for this would be checking the EnderMan class, as its not behaviour intrinsecally connected to the item but rather the enderman:

The EnderMan.isLookingAtMeMethod should return false when a player is wearing your armour piece. In that method you can see a call to ForgeHooks.shouldSuppressEnderManAnger() which uses an ItemStack of the object on the players head. This uses IForgeItem's isEnderMask method that brings you to:

default boolean isEnderMask(ItemStack stack, Player player, EnderMan endermanEntity) {
return stack.getItem() == Blocks.CARVED_PUMPKIN.asItem(); 
}

which means you can override it on your armour item (since all item classes extend from IForgeItem, including ArmorItem from which you will most likely want to extend from)

 

As for the second thing you'll most likely need to get creative: Using levitation can work if you want to make it floaty, but you most likely want to make it work as if the player is walking on air. I'd suggest something along the lines of checking the block immediately in the direction the player is facing, and if its air, place a transparent, solid block the player will walk on. As the player walks in some arbitrarry direction, keep checking to generate blocks in their path as well as deleting the ones left behind/in any direction the player isn't looking at. You will have to get *even more creative* to think how can you implement it as for only the armour user can stand on air (placing a solid block will make anyone be able to stand on it regardless of if wearing the armour or not)

 

So yeah. First thing pretty straightforward, second one youll have to make your own idea around it.

Edited by chxr
small edit
  • Thanks 1
Posted

Okay, thank you so much for your help. I will try out your first idea over the coming days; the second one will probably take a while to complete, even more so due to the fact I'm inexperienced with modding, though your idea for it seems plausible.

I will post updates here as I go along, including issues, to both keep track of progress and to get help for it. 

 

Your contributions are much appreciated.

 

 

  • Thanks 1

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.