Jump to content

Armor calculator


Bedrock_Miner

Recommended Posts

Is it possible to change the calculation of armor so that a Diamond armor for example only protects you from 40% of the damage instead of 80%?

Can you change the protection Values of Vanilla Armor?

 

I think there must be a way of doing this, because with the DivineRPG Mod it works. There a Diamond Armor only fills half of the Armor Bar.

Link to comment
Share on other sites

Well, it really depends on if you care about compatibility with other mods.

One way to do it is:

//Declare new ENUM
public static EnumArmourMaterial DIAMOND = ...
//Create new Diamond Set with your EnumArmourMaterial
//Make replacement in preInit (or load, I don't really remember)
Item.itemsList[item.helmetDiamond.itemID] = MyHelmetDiamond;

You can also use reflection to edit vanilia ENUMs or... well, delete diamond armours from game and add your own (similar to 1st idea, but causes crashes if you don't secure compatibility) or... Someone else?

1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

In EnumArmorMaterial, when decompiled you should find this.

 

    DIAMOND(33, new int[]{3, 8, 6, 3}, 10);

 

The 2D array of int ( int[] ) is the amount of damage it reduces (gui on armor, damage reduction)

 

In others words,

{3, 8, 6, 3} is the Damage Reduction / GUI on armor.

 

Mess around with the code, and you shall find what changes what. :)

Link to comment
Share on other sites

1. Reflection

Total compatibility with all stuff that doesn't touch same code (I mean, you can't override something twice, it's pointless - logical ;p)

How: Well, that's more normal java stuff rather than just forge, I would suggest reading java documentation.

2. ItemArray Override

Second best way, as told before:

Declare new ENUM with your own stats, create new Armour set, make them use your ENUM then in preInit make ID override.

Perks of this one is that you still have full compatibility with all other stuff, yet it's not as good as reflection.

The downside is that you don't just make some armour work differently, but you tell every method that calls this armour, to use your armour instead.

Item.itemsArray[armourID] = MyArmour;

Next thing is that you will have two same-different things in your game. You will have MyArmour that has MyID, and Armour that has normal ID, yet when you use use any of them you will always refere to MyArmour (I really belive you understand).

 

Oh, and btw. I am refering to 1.6.x! 1.7.x doesn't have declared static ID's, they are assigned on runtime, so I don't know about this whole " two same-different things", but I am sure that it will work (maybe even same way as on 1.6.x).

 

P.S - your thread title is at least weird ;o (not accurate)

1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

1. Reflection

Total compatibility with all stuff that doesn't touch same code (I mean, you can't override something twice, it's pointless - logical ;p)

How: Well, that's more normal java stuff rather than just forge, I would suggest reading java documentation.

2. ItemArray Override

Second best way, as told before:

Declare new ENUM with your own stats, create new Armour set, make them use your ENUM then in preInit make ID override.

Perks of this one is that you still have full compatibility with all other stuff, yet it's not as good as reflection.

The downside is that you don't just make some armour work differently, but you tell every method that calls this armour, to use your armour instead.

Item.itemsArray[armourID] = MyArmour;

Next thing is that you will have two same-different things in your game. You will have MyArmour that has MyID, and Armour that has normal ID, yet when you use use any of them you will always refere to MyArmour (I really belive you understand).

 

Oh, and btw. I am refering to 1.6.x! 1.7.x doesn't have declared static ID's, they are assigned on runtime, so I don't know about this whole " two same-different things", but I am sure that it will work (maybe even same way as on 1.6.x).

 

P.S - your thread title is at least weird ;o (not accurate)

Thanks a lot, I think i can work with this.

 

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.