Jump to content

[1.7.10][Solved] Is there a way to edit the stats of Vanilla Armor/Horse Armor.


Recommended Posts

Posted

I want to reduce the stats of vanilla armor (so new Armor tiers are greater than Diamond). I ended up making new versions of Vanilla armor, and replaced a lot of Vanilla items with my new items, but I need to replace entities that spawn with them, horse armor, and edit chest so they contain the new horse armor instead.

 

I feel like a lot of this effort would be unnecessary if I could just change the stats of the Vanilla Armor and Horse Armor. I read this tutorial (although that now it's @SubscribeEvent instead of @ForgeSubscribe): http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/1571568-tutorial-1-6-2-changing-vanilla-without-editing

 

Is there a way to do this?

Posted

What I do for this in my mod is to use a PlayerTickEvent to replace the items if they are in the player's inventory.

Check out my mod, Realms of Chaos, here.

 

If I helped you, be sure to press the "Thank You" button!

Posted

@OP - Sorry, I'm about to go slightly off topic for a second.

 

@Eternaldoom - you really ought to reconsider how you are doing that... horribly inefficient. A much better approach would be to Map the item you want to search for to the item you want to replace it with, and do something like this:

@SubscribeEvent
public void onTickEvent(PlayerTickEvent evt){
ItemStack stack;
for (int i = 0; i < evt.player.inventory.getSizeInventory(); ++i) {
stack = evt.player.inventory.getStackInSlot(i);
if (stack != null && yourItemMap.contains(stack.getItem()) && evt.player.inventory.consumeInventoryItem(stack.getItem()) {
evt.player.inventory.setInventorySlotContents(i, new ItemStack(yourItemMap.get(stack.getItem()));
}
}

This is much more efficient and easy to manage than tons of if statements; at the very least, use chained if/else-if statements.

Posted

You're right, thanks. I'm probably going to switch over to GameRegistry.addSubstitutionAlias. It'll be more seamless anyway.

Check out my mod, Realms of Chaos, here.

 

If I helped you, be sure to press the "Thank You" button!

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.