Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

I'm new at modding and while i was creating custom snowball i've got an error in my registry class: Cannot resolve constructor "FriedSnowball"

So here is my Registration class:

package net.andr11ew.friedsnow.entity;

import net.andr11ew.friedsnow.FriedSnow;
import net.andr11ew.friedsnow.entity.custom.FriedSnowball;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.MobCategory;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;

public class ModEntityTypes {
    public static final DeferredRegister<EntityType<?>> ENTITY_TYPES =
            DeferredRegister.create(ForgeRegistries.ENTITIES, FriedSnow.MOD_ID);


    public static final RegistryObject<EntityType<FriedSnowball>> FRIED_SNOWBALL_ENTITY =
            ENTITY_TYPES.register("fried_snowball_entity",
                    () -> EntityType.Builder.of(FriedSnowball::new, MobCategory.MISC)
                            .sized(0.25F, 0.25F).clientTrackingRange(4).updateInterval(10));


    public static void register(IEventBus eventBus) {
        ENTITY_TYPES.register(eventBus);

    }
}

I'm getting early mentioned error here: () -> EntityType.Builder.of(FriedSnowball::new

Also here's entity class:

package net.andr11ew.friedsnow.entity.custom;

import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.monster.Blaze;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.entity.projectile.Snowball;
import net.minecraft.world.item.enchantment.ProtectionEnchantment;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.EntityHitResult;

public class FriedSnowball extends Snowball {


    public FriedSnowball(Level p_37399_, LivingEntity p_37400_) {
        super(p_37399_, p_37400_);
    }


    public FriedSnowball(Level p_37394_, double p_37395_, double p_37396_, double p_37397_) {
        super(p_37394_, p_37395_, p_37396_, p_37397_);
    }

    public FriedSnowball(EntityType<? extends FriedSnowball> p_37391_, Level p_37392_) {
        super(p_37391_, p_37392_);
    }


    @Override
    protected void onHitEntity(EntityHitResult pResult) {
        super.onHitEntity(pResult);
        Entity entity = pResult.getEntity();
        entity.setSecondsOnFire(1);
    }
}

I've tried so many things, but didn't fixed it. Will really appreciate your help!

By the way this is forge 1.18.2

Edited by andr11ew

    public static final RegistryObject<EntityType<FriedSnowball>> FRIED_SNOWBALL_ENTITY =
            ENTITY_TYPES.register("fried_snowball_entity",
                    () -> EntityType.Builder.<FriedSnowball>of(FriedSnowball::new, MobCategory.MISC)
                            .sized(0.25F, 0.25F).clientTrackingRange(4).updateInterval(10).build(null));

You are not calling build() for your builder

and you need to tell it the type parameter for the builder because its one of those things where java's type inference doesn't work,

it's trying to use EntityType<Entity> from the ENTITY_TYPES.

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.