Jump to content

Unbreakable Armor


ezeglace

Recommended Posts

So i have been making armor and one thing i noticed was that when you enter 0 for the durability in the enumarmormaterial, while unbreakable it does not protect you at all.

This is the code that i have written.

public static EnumArmorMaterial armorPure = EnumHelper.addArmorMaterial("Pure", 0, new int[]{10, 16, 14, 10}, 0);

As you can see the durability is set to zero but it does not protect when worn.

is there anyway to have the armor truly unbreakable while protect you as it should?

 

Link to comment
Share on other sites

What happens if you override isDamageable() in your new armor class with something like this?

 

    public boolean isDamageable()    { return false; }

 

I'm guessing that's checked before damage is applied to an item (though I could be way off, I'm still new at this).

 

Nope, that don't work. I'll just go sit quietly now.

Link to comment
Share on other sites

I tried that and unfortunately it does not work

 

I'm poring over the code now (you've piqued my curiosity). The trick is to find out where damage is applied and override that method...  I can say that it doesn't seem to be getDamage, or getItemDamage. Overriding both of those to return 0 doesn't seem to help.

 

Update: It looks like damaging items is handled in the ItemStack class. I was apparently on the right track, but ItemStack.damageItem doesn't pay attention to isDamageable(), just isItemStackDamageable()

 

Maybe an extension from ItemStack overriding isItemStackDamageable or damageItem(), that checks for a flag that your immortal armor has set before applying damage.

Link to comment
Share on other sites

It looks like damaging items is handled in the ItemStack class. I was apparently on the right track, but ItemStack.damageItem doesn't pay attention to isDamageable(), just isItemStackDamageable()

 

Maybe an extension from ItemStack overriding isItemStackDamageable or damageItem(), that checks for a flag that your immortal armor has set before applying damage...

 

Naw, that'll need overrides all the way up to the player to change the armor inventory type...

 

I'm not well-versed in forge events, but I think Mazetar has the right idea. If there's an event you can trap when an item is damaged, you can have it self-heal...

Link to comment
Share on other sites

public ItemArmor(int par1, EnumArmorMaterial par2EnumArmorMaterial, int par3, int par4)

    {

        super(par1);

        this.material = par2EnumArmorMaterial;

        this.armorType = par4;

        this.renderIndex = par3;

        this.damageReduceAmount = par2EnumArmorMaterial.getDamageReductionAmount(par4);

        this.setMaxDamage(par2EnumArmorMaterial.getDurability(par4));

        this.maxStackSize = 1;

        this.setCreativeTab(CreativeTabs.tabCombat);

        BlockDispenser.dispenseBehaviorRegistry.putObject(this, field_96605_cw);

    }

 

 

just saying you could return 0 to that ....

 

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

Link to comment
Share on other sites

        this.damageReduceAmount = par2EnumArmorMaterial.getDamageReductionAmount(par4);

 

just saying you could return 0 to that ....

 

That's the amount of damage the armor takes? I read it as that's the amount of damage it absorbs... damn obfuscation...

Link to comment
Share on other sites

yes, brain not working too well so late

 

but

 

your custom enum armor material should override

 

public int getDurability(int par1)

    {

        return ItemArmor.getMaxDamageArray()[par1] * this.maxDamageFactor;

    }

and that could return Integer.MAX_VALUE

 

the armor wouldnt be unbreakable... but it would sure take a super long time to break

 

other then that i kinda agree with Mazetar, or make a TickHandler that restore this armor type to max durability

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

Link to comment
Share on other sites

Found in Item

 

     /**
     * Called each tick as long the item is on a player inventory. Uses by maps to check if is on a player hand and
     * update it's contents.
     */
    public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5) {}

 

Might, perhaps, be overkill...

Link to comment
Share on other sites

Dude int's max value is insanely large, I doubt you can break it at all lols!

 

Edit: re-reading the last posts from you I find it clear that you have all you need to reach A solution to your problem :)

If you guys dont get it.. then well ya.. try harder...

Link to comment
Share on other sites

No idea at the top of my head, but tileEntity of the anvil should reveal this ;)

 

Not true. It is in the EnumToolMaterial xD

 

Which could pose a problem :/

I am Mew. The Legendary Psychic. I behave oddly and am always playing practical jokes.

 

I have also found that I really love making extremely long and extremely but sometimes not so descriptive variables. Sort of like what I just did there xD

Link to comment
Share on other sites

Hehe as I said no idea, but I would assume the anvils inner workings would reveal whatever it was ;)

 

Well that might not be a problem, since you could make your own materials? :)

 

If you guys dont get it.. then well ya.. try harder...

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • 20 SLOT DEMO GRATIS PRAGMATIC PLAY x500 RUPIAH ANTI LAG & 20 DEMO SLOT MAHJONG WAYS PG SOFT GRATIS ANTI RUNGKAD KLIK DISINI DAFTAR DISINI SLOT VVIP << KLIK DISINI DAFTAR DISINI SLOT VVIP << KLIK DISINI DAFTAR DISINI SLOT VVIP << KLIK DISINI DAFTAR DISINI SLOT VVIP << SITUS SLOT GACOR 88 MAXWIN X500 HARI INI TERBAIK DAN TERPERCAYA GAMPANG MENANG Dunia Game gacor terus bertambah besar seiring berjalannya waktu, dan sudah tentu dunia itu terus berkembang serta merta bersamaan dengan berkembangnya SLOT GACOR sebagai website number #1 yang pernah ada dan tidak pernah mengecewakan sekalipun. Dengan banyaknya member yang sudah mempercayakan untuk terus menghasilkan uang bersama dengan SLOT GACOR pastinya mereka sudah percaya untuk bermain Game online bersama dengan kami dengan banyaknya testimoni yang sudah membuktikan betapa seringnya member mendapatkan jackpot besar yang bisa mencapai ratusan juta rupiah. Best online Game website that give you more money everyday, itu lah slogan yang tepat untuk bermain bersama SLOT GACOR yang sudah pasti menang setiap harinya dan bisa menjadikan bandar ini sebagai patokan untuk mendapatkan penghasilan tambahan yang efisien dan juga sesuatu hal yang fix setiap hari nya. Kami juga mendapatkan julukan sebagai Number #1 website bocor yang berarti terus memberikan member uang asli dan jackpot setiap hari nya, tidak lupa bocor itu juga bisa diartikan dalam bentuk berbagi promosi untuk para official member yang terus setia bermain bersama dengan kami. Berbagai provider Game terus bertambah banyak setiap harinya dan terus melakukan support untuk membuat para official member terus bisa menang dan terus maxwin dalam bentuk apapun maka itu langsung untuk feel free to try yourself, play with SLOT GACOR now or never !
    • BOCORAN POLA SLOT GACOR MAHJONG WAYS MAXWIN x500 PETIR MERAH HARI INI HINGGA MALAM INI KLIK DISINI DAFTAR SLOT VVIP << KLIK DISINI DAFTAR SLOT VVIP << KLIK DISINI DAFTAR SLOT VVIP << KLIK DISINI DAFTAR SLOT VVIP << SITUS SLOT GACOR 88 MAXWIN X500 HARI INI TERBAIK DAN TERPERCAYA GAMPANG MENANG Dunia Game gacor terus bertambah besar seiring berjalannya waktu, dan sudah tentu dunia itu terus berkembang serta merta bersamaan dengan berkembangnya SLOT GACOR sebagai website number #1 yang pernah ada dan tidak pernah mengecewakan sekalipun. Dengan banyaknya member yang sudah mempercayakan untuk terus menghasilkan uang bersama dengan SLOT GACOR pastinya mereka sudah percaya untuk bermain Game online bersama dengan kami dengan banyaknya testimoni yang sudah membuktikan betapa seringnya member mendapatkan jackpot besar yang bisa mencapai ratusan juta rupiah. Best online Game website that give you more money everyday, itu lah slogan yang tepat untuk bermain bersama SLOT GACOR yang sudah pasti menang setiap harinya dan bisa menjadikan bandar ini sebagai patokan untuk mendapatkan penghasilan tambahan yang efisien dan juga sesuatu hal yang fix setiap hari nya. Kami juga mendapatkan julukan sebagai Number #1 website bocor yang berarti terus memberikan member uang asli dan jackpot setiap hari nya, tidak lupa bocor itu juga bisa diartikan dalam bentuk berbagi promosi untuk para official member yang terus setia bermain bersama dengan kami. Berbagai provider Game terus bertambah banyak setiap harinya dan terus melakukan support untuk membuat para official member terus bisa menang dan terus maxwin dalam bentuk apapun maka itu langsung untuk feel free to try yourself, play with SLOT GACOR now or never !
    • Museumbola merupakan wadah judi online terkhusus untuk sbobet atau judi bola. Dengan daftar dan deposit menggunakan BANK BCA, Anda berkesempatan mendapatkan prediksi jitu pertandingan secara update setiap hari yang bisa anda jadikan acuan untuk bermain judi bola. Hanya dengan 10 ribu rupiah dan anda bermain Mix Parlay menggunakan prediksi yang telah di sediakan oleh kami, anda akan memenangkan jutaan rupiah. Yuk segera klik DAFTAR sekarang juga.
    • I was just trying to play my modded world when i randomly got this crash for no reason. I sorted through like every mod and eventually I realized it was LLibrary but I can't seem to find a solution to fix the crashing. I can't lose the world that I have that uses this mod please help me. Here's the report: https://pastebin.com/0D00B79i If anyone has a solution please let me know.  
    • 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑 🤑DAFTAR & LOGIN🤑   Daftar Slot Ligawin88 adalah bocoran slot rekomendasi gacor dari Ligawin88 yang bisa anda temukan di SLOT Ligawin88. Situs SLOT Ligawin88 hari ini yang kami bagikan di sini adalah yang terbaik dan bersiaplah untuk mengalami sensasi tak terlupakan dalam permainan slot online. Temukan game SLOT Ligawin88 terbaik dengan 100 pilihan provider ternama yang dipercaya akan memberikan kepuasan dan kemenangan hari ini untuk meraih x500. RTP SLOT Ligawin88 merupakan SLOT Ligawin88 hari ini yang telah menjadi pilihan utama bagi pemain judi online di seluruh Indonesia. Setiap harinya jutaan pemain memasuki dunia maya untuk memperoleh hiburan seru dan kemenangan besar dalam bermain slot dengan adanya bocoran RTP SLOT Ligawin88. Tidak ada yang lebih menyenangkan daripada mengungguli mesin slot dan meraih jackpot x500 yang menggiurkan di situs SLOT Ligawin88 hari ini yang telah disediakan SLOT Ligawin88. Menangkan jackpot besar x500 rajanya maxwin dari segala slot dan raih kemenangan spektakuler di situs Ligawin88 terbaik 2024 adalah tempat yang menyediakan mesin slot dengan peluang kemenangan lebih tinggi daripada situs slot lainnya. Bagi anda yang mencari pengalaman judi slot paling seru dan mendebarkan, situs bo SLOT Ligawin88 terbaik 2024 adalah pilihan yang tepat. Jelajahi dunia slot online melalui situs SLOT Ligawin88 di link SLOT Ligawin88.
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.