DroidCrafter23 Posted November 17, 2024 Posted November 17, 2024 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. Quote
chxr Posted November 18, 2024 Posted November 18, 2024 (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 November 18, 2024 by chxr small edit 1 Quote
DroidCrafter23 Posted November 19, 2024 Author Posted November 19, 2024 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. 1 Quote
Recommended Posts
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.