#Start first mod

23 messages · Page 1 of 1 (latest)

teal cosmos
#

hey I've started modding some days ago and I already made a mod that adds a banana to the game. Now I want to add a mod that adds pig armor to the game. I just wanted to ask what I need for that and what I need to consider and be aware of while making the mod.

prisma oar
#

Learn about DataComponentTypes they're essentially the new structure of items

teal cosmos
#

Will I find it in the fabric wiki?

prisma oar
teal cosmos
#

ohh lets goo

#

thanks man

#

and how does everything work with the crafting interface?

#

for example I want to make a pig armor and I would need normal armor for it plus some carrots

prisma oar
teal cosmos
#

thanks man

#

sorry if I asked dumb questions but im new to this modding space

prisma oar
#

sure

teal cosmos
#

👍

#

hey so I started making the mod

#

and I got some problems

package;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import net.fabricmc.api.ModInitializer;
import net.minecraft.data.client.BlockStateModelGenerator;
import net.minecraft.item.ArmorMaterial;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.util.Identifier;

public class CustomArmorMaterial implements ArmorMaterial {
    private static final int[] BASE_DURABILITY = new int[] {13, 15, 16, 11};
    private static final int[] PROTECTION_VALUES = new int[] {A, B, C, D};

    // A is boots, B leggins, c chestplate, and D helmet
    // For reference, Leather uses {1, 2, 3, 1}, and Diamond/Netherite {3, 6, 8, 3}

    @Override
    public int method_7696(EquipmentSlot slot) {
        return BASE_DURABILITY[slot.getEntitySlotId()];
    }

    @Override
    public int method_7697(EquipmentSlot slot) {
        return BASE_DURABILITY[slot.getEntitySlotId()];
    }

    @Override
    public int getEnchantability() {
        return X;
    }
    
    @Override
    public SoundEvent getEquipSound {
        return SoundEvents.ITEM_ARMOR_EQUIP_X;
    }

    @Override
    public Ingredient getRepairIngredient() {
        return Ingredient.ofItems(RegisterItems.X);
    }

    @Override
    public String getName() {
        // Must be all lowercase
        return "name";
    }

    @Override
    public float getToughness() {
        return X.0F;
    }

    @teluri 
    public float getKnockbackResistance() {
        return X.0F;
    }

}
static tiger
#

ok whats the problem?

teal cosmos
#

so basically the parameters are red and things like the class name

compact loom
#

So for example X.0F you would change to 3.0F or something

fast pike
#

i can also recommend the Tutorial Series by Kaupenjoe on YouTube, there you can learn the most basic stuff and later on some more advanced.

teal cosmos
dry viper
#

if youre still workin on this, from 1.20.5 onwards armor is implemented differently, I got stuck in the same place

#

search the discord for "armormaterial" that should point you in (what I believe to be) the right direction