The Meaning of Life, the Universe, and Everything.
Join Date:
6/2/2014
Posts:
100
Minecraft:
teh_herper
Member Details
Also, Is there a way to stop getArmorDisplay from overriding the reduction amounts set in the ArmorMaterial? Or is there a way to alter each piece of armor individually?
Rollback Post to RevisionRollBack
Fact: Using flint and steel on a creeper causes them to stop in place and blow up.
Also, Is there a way to stop getArmorDisplay from overriding the reduction amounts set in the ArmorMaterial? Or is there a way to alter each piece of armor individually?
getArmorDisplay() is called for each piece of armor.
It is causing lag because each piece is constantly performing this check. You're going to want to have once piece perform all checking.
Could u show me an example how to make it into one piece i cant really solve it please
Pick any random piece you want to have perform the check. Create an if() statement to see if the player is wearing said piece. Inside of that if statement then check for the rest of the armor.
Wait one more complicated thing what do you mean by check is that another if statement?
Yes
So heres what will i do .
if(boots !=null){//checking if the player is wearing the said piece
if(this == myhelm){
if(this == mychest){
if(this == mylegs){
if(this == myboots){
perform action
Wait one more complicated thing what do you mean by check is that another if statement?
Yes
So heres what will i do .
if(boots !=null){//checking if the player is wearing the said piece
if(this == myhelm){
if(this == mychest){
if(this == mylegs){
if(this == myboots){
perform action
Wait one more complicated thing what do you mean by check is that another if statement?
Yes
So heres what will i do .
if(boots !=null){//checking if the player is wearing the said piece
if(this == myhelm){
if(this == mychest){
if(this == mylegs){
if(this == myboots){
perform action
No no no no no. This is the format:
if() {
if() {
if(){
//etc...
}
}
}
But my code is right?
EDIT: DINT WORK -__- damn this really simple code stress me much
Wait one more complicated thing what do you mean by check is that another if statement?
Yes
So heres what will i do .
if(boots !=null){//checking if the player is wearing the said piece
if(this == myhelm){
if(this == mychest){
if(this == mylegs){
if(this == myboots){
perform action
No no no no no. This is the format:
if() {
if() {
if(){
//etc...
}
}
}
But my code is right?
EDIT: DINT WORK -__- damn this really simple code stress me much
Fact: Using flint and steel on a creeper causes them to stop in place and blow up.
getArmorDisplay() is called for each piece of armor.
-
View User Profile
-
View Posts
-
Send Message
Curse Premiumi did this code but it has 4 ticks and it sometimes cause lag could u help me by reducing the ticks to 1 ? or simplifying it
heres my code
@Override public void onArmorTick(World world, EntityPlayer player, ItemStack armor) { ItemStack boots = player.getCurrentArmor(0); ItemStack legs = player.getCurrentArmor(1); ItemStack chest = player.getCurrentArmor(2); ItemStack helmet = player.getCurrentArmor(3); int duration = 15; if(boots != null && legs != null && chest != null && helmet != null) { if(boots.getItem() == MHFCRegItem.mhfcitemkirinSboots && legs.getItem() == MHFCRegItem.mhfcitemkirinSlegs && chest.getItem() == MHFCRegItem.mhfcitemkirinSchest && helmet.getItem() == MHFCRegItem.mhfcitemkirinShelm) { player.addPotionEffect(new PotionEffect(MHFCRegPotion.mhfcpotionkirinbless.id, duration++, 1)); } } }It is causing lag because each piece is constantly performing this check. You're going to want to have once piece perform all checking.
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumCould u show me an example how to make it into one piece i cant really solve it please
i am ahad5522 its my minecraft server name i want change my skin
Pick any random piece you want to have perform the check. Create an if() statement to see if the player is wearing said piece. Inside of that if statement then check for the rest of the armor.
Wrong post/forum to ask in.
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumIm sorry if i misinterpret
[pre]ItemStack boots = player.getCurrentArmor(0); int duration = 15; if(boots != null) { if(boots.getItem() == MHFCRegItem.mhfcitemkirinSboots && this == MHFCRegItem.mhfcitemkirinSlegs && this) == MHFCRegItem.mhfcitemkirinSchest && this == MHFCRegItem.mhfcitemkirinShelm) { player.addPotionEffect(new PotionEffect(MHFCRegPotion.mhfcpotionkirinbless.id, duration++, 1)); }[/pre]if(this == YourHelmet) { //Check for the rest of the armor here }-
View User Profile
-
View Posts
-
Send Message
Curse Premium-
View User Profile
-
View Posts
-
Send Message
Curse Premiumif(boots == null || legs == null || chest == null || helmet == null || boots.getItem != BaseMyMod.rubyboots || legs.getItem != BaseMyMod.rubylegs || chest.getItem != BaseMyMod.rubychest || helmet.getItem != BaseMyMod.rubyhelmet){
But if you have many differnts armor sets that allows you to fly(example) you need to make longer if statement to include this armor...
Check out all my mods here: Elix'x mods hub!
Yes
That code needs to be inside of a Tick Handler or else it will never be called. The armor tick update method is only called while the armor is worn.
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumSo heres what will i do .
if(boots !=null){//checking if the player is wearing the said piece if(this == myhelm){ if(this == mychest){ if(this == mylegs){ if(this == myboots){ perform actionNo no no no no. This is the format:
if() { if() { if(){ //etc... } } }-
View User Profile
-
View Posts
-
Send Message
Curse PremiumOf course it must be written inside the Tick handler. I just showed what you must add inside Tick Handler;(i was lazy to copy all code there)
Check out all my mods here: Elix'x mods hub!
-
View User Profile
-
View Posts
-
Send Message
Curse PremiumBut my code is right?
EDIT: DINT WORK -__- damn this really simple code stress me much
heres what i got
@Override public void onArmorTick(World world, EntityPlayer player, ItemStack armor) { ItemStack boots = player.getCurrentArmor(0); // ItemStack legs = player.getCurrentArmor(1); // ItemStack chest = player.getCurrentArmor(2); // ItemStack helmet = player.getCurrentArmor(3); if(boots != null) { if(this == MHFCRegItem.mhfcitemkirinSboots) { if(this == MHFCRegItem.mhfcitemkirinSchest) { if(this == MHFCRegItem.mhfcitemkirinSboots){ if(this == MHFCRegItem.mhfcitemkirinSlegs){ int duration = 15; player.addPotionEffect(new PotionEffect(MHFCRegPotion.mhfcpotionkirinbless.id, duration++, 1)); world.spawnParticle("cloud", player.posX + this.rand.nextFloat() * 2.0F - 1.0D, player.posY + this.rand.nextFloat() * 3.0F + 1.0D, player.posZ + this.rand.nextFloat() * 2.0F - 1.0D, 0.0D, 0.0D, 0.0D); } } } } } } }Do not use this == for everything. Only for the first if() statement. Then after that check the players armor slots.
-
View User Profile
-
View Posts
-
Send Message
Curse Premium