O'Reilly logo

Minecraft™ Mod Development in 24 Hours, Sams Teach Yourself by Jimmy Koene

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating the Armor

Now it’s time to create the armor items.

The Mod File Code

Just like with any other item, you need to create the object, initialize it, and finally register it. Listing 8.1 shows all of the armor code required in the mod file. The Item objects are also ordered like the arrays used for the ArmorMaterial.

LISTING 8.1 Armor Code

//armorpublic static Item samhelmet;public static Item samchest;public static Item samleggings;public static Item samboots;ArmorMaterial samarmor = EnumHelper.addArmorMaterial("samarmor", 20, new int[] { 3, 7, 6, 3 }, 10);

Listing 8.2 shows the code that is required to be added in the preInit method.

LISTING 8.2 preInit Armor Code

//armor ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required