Jump to content

Recommended Posts

Posted

HI, when I set MAX_DAMAGE_FACTOR greater than 1 this error comes, for example I set the Max damage factor to 2 - 

Error loading mods

1 error has occurred during loading

Forge Mod (forge_mod) encountered an error during the common_setup event phase 

java.lang.ArrayIndexOutOfBoundsException: Index 6 out of bounds for length 4

 

whereas if I set the MAX_DAMAGE_FACTOR 3 this error comes - 

Forge Mod (forge_mod) encountered an error during the common_setup event phase 

java.lang.ArrayIndexOutOfBoundsException: Index 9 out of bounds for length 4

 

My Code - 

package com.anirudh.forgemod.armor;

import com.anirudh.forgemod.ForgeMod;
import com.anirudh.forgemod.util.RegistryHandler;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.item.ArmorMaterial;
import net.minecraft.world.item.crafting.Ingredient;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;

import java.util.function.Supplier;

public enum ModArmorMaterial implements ArmorMaterial {

    RUBY(ForgeMod.MOD_ID + ":ruby",2, new int[] { 2, 5, 6, 2}, 999999999,
            SoundEvents.AMBIENT_CAVE, 1000.0F, () ->{ return Ingredient.of(RegistryHandler.RUBY.get()); });

    private static final int[] MAX_DAMAGE_ARRAY = new int[] {11, 16, 15, 13 };
    private final String name;
    private final int maxDamageFactor;
    private final int[] damageReductionAmountArray;
    private final int enchantability;
    private final SoundEvent soundEvent;
    private final float toughness;
    private final Supplier<Ingredient> repairMaterial;

    ModArmorMaterial(String name, int maxDamageFactor, int[] damageReductionAmountArray, int enchantability,
                     SoundEvent soundEvent, float toughness, Supplier<Ingredient> repairMaterial){
        this.name = name;
        this.maxDamageFactor = maxDamageFactor;
        this.damageReductionAmountArray = damageReductionAmountArray;
        this.enchantability = enchantability;
        this.soundEvent = soundEvent;
        this.toughness = toughness;
        this.repairMaterial = repairMaterial;
    }

    @Override
    public int getDurabilityForSlot(EquipmentSlot equipmentSlot) {
        return MAX_DAMAGE_ARRAY[equipmentSlot.getIndex() * this.maxDamageFactor];
    }

    @Override
    public int getDefenseForSlot(EquipmentSlot equipmentSlot)
     {
        return this.damageReductionAmountArray[equipmentSlot.getIndex()];
    }

    @Override
    public int getEnchantmentValue() {
        return this.enchantability;
    }

    @Override
    public SoundEvent getEquipSound() {
        return this.soundEvent;
    }

    @Override
    public Ingredient getRepairIngredient() {
        return this.repairMaterial.get();
    }

   @OnlyIn(Dist.CLIENT)

    @Override
    public String getName() {
        return this.name;
    }

    @Override
    public float getToughness() {
        return this.toughness;
    }

    @Override
    public float getKnockbackResistance() {
        return 0;
    }
}

 

Posted

In one of the lines I wrote

    RUBY(ForgeMod.MOD_ID + ":ruby",1, new int[] { 2, 5, 6, 2, }, 999999999,
            SoundEvents.AMBIENT_CAVE, 1000.0F, () ->{ return Ingredient.of(RegistryHandler.RUBY.get()).group(); });

The error is - Cannot resolve method 'group' in Ingredient, I think the name has changed but to which name?

Posted

In registry Handler - 

    public static final RegistryObject<ArmorItem> RUBY_HELMET = ITEMS.register("ruby_helmet", () ->
            new ArmorItem(ModArmorMaterial.RUBY, EquipmentSlot.HEAD, new Item.Properties().group()));

the same error as the previous one

Posted

my code - 

package com.anirudh.forgemod.world.gen;

import com.anirudh.forgemod.ForgeMod;
import net.minecraft.world.level.biome.Biome;

import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLLoadCompleteEvent;
import net.minecraftforge.registries.ForgeRegistries;

@Mod.EventBusSubscriber(modid = ForgeMod.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD)
public class ModOreGen {

    @SubscribeEvent
    public static void generateOres(FMLLoadCompleteEvent event){
        for (Biome biome : ForgeRegistries.BIOMES){

            if (biome.getBiomeCategory() == Biome.BiomeCategory.NETHER){

            } else if (biome.getBiomeCategory() == Biome.BiomeCategory.THEEND){

            } else {

            }
        }
    }
    private static void genOre(Biome biome, int count, int bottomOffset, int topOffset, int max, OreFeatureConfig.FillerBlockType filler,BlockState defaultBlockstate, int size){

    }
}

Error - Cannot resolve symbol 'OreFeatureConfig' :31

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • As a stay-at-home dad and a farmer in Kentucky, my primary focus has always been on nurturing my family and managing our land. When Bitcoin began to gain traction, I saw it as a potential opportunity to secure our financial future. With my wife encouragement, I decided to invest $10,000 from our savings into cryptocurrency. Over time, my investment flourished beyond my wildest dreams, eventually soaring to an astonishing $200,000. Just as I began to feel a sense of financial security, disaster struck. In a shocking act of betrayal fueled by jealousy, my wife hacked into my email and gained access to my Bitcoin wallet. The devastation I felt was overwhelming years of careful planning and smart investing were wiped out in an instant. I was left feeling helpless and uncertain, grappling with the fear that I might never recover what I had lost. In the midst of this turmoil, a close friend reached out to me and mentioned RAPID DIGITAL RECOVERY. Desperate for a solution but still holding onto a glimmer of hope, I contacted them, praying for a lifeline. Their team responded promptly, providing both reassurance and a clear plan of action. With remarkable expertise, they tracked down the digital footprints left by the theft and successfully recovered a substantial portion of my stolen funds. But their assistance didn’t end there. Understanding the vulnerability I felt after such a betrayal, they also offered invaluable advice on how to strengthen my digital security to prevent future breaches. Their support was not just technical; it was a source of empowerment that helped me regain my confidence and sense of control over my financial situation. While the betrayal was a painful lesson, it ultimately taught me resilience and the importance of safeguarding my assets. Thanks to RAPID DIGITAL RECOVERY, I didn’t just reclaim my lost Bitcoin; I also regained my peace of mind. This experience has transformed my perspective on both trust and security in the digital age. I now approach investments with a renewed sense of caution and awareness, ensuring that I protect not only my financial future but also my emotional well-being. The journey has been challenging, but it has also been a testament to my strength and determination to rise above adversity as I continue to balance my roles as a dad and a farmer.
    • Same issue without Oculus Flywheel Compat?
    • When i start my game with a shader active the game crashes with this Error: java.lang.NoSuchFieldError: TESSELATION_SHADERS Minecraft java 1.20.1 in forge 47.4.0 crash report in pastebin: https://pastebin.com/6xiwHqZW thanks in advance
    • If you are using AMD/ATI, update your drivers - get the drivers from their website - do not update via system
    • Not sure why this is happening, but I would love some help. The reason I restarted the server was because I was getting an error while trying to join regarding this "Internal Exception: io.netty.handler.codec.DecoderException: io.netty.handler.codec.EncoderException: java.io.IOException: Root tag must be a named compound tag" Im using ServerMiner if thats any help
  • Topics

×
×
  • Create New...

Important Information

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