#An error that I can't fix. "Expected 1 argument but found 0"

15 messages · Page 1 of 1 (latest)

hollow arch
#

I would really appreciate it if someone told me how I can fix this and why this is happening. So it doesn't happen again.

#

Full code:

#

package net.keith.entity;

import net.fabricmc.fabric.api.object.builder.v1.entity.FabricDefaultAttributeRegistry;
import net.fabricmc.fabric.api.object.builder.v1.entity.FabricEntityTypeBuilder;
import net.keith.Tricky;
import net.keith.entity.custom.TrickyEntity;
import net.minecraft.entity.EntityDimensions;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.SpawnGroup;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.util.Identifier;

public class ModEntities {
public static final EntityType<TrickyEntity> TRICKY = Registry.register(
Registries.ENTITY_TYPE,
// Use Identifier.of() instead of the private constructor
Identifier.of(Tricky.MOD_ID, "tricky"),
FabricEntityTypeBuilder.create(SpawnGroup.MONSTER, TrickyEntity::new)
.dimensions(EntityDimensions.fixed(0.4f, 0.8f))
.fireImmune()
.build()
);

public static void registerModEntities() {
    // Ensure createTrickyAttributes() returns a built DefaultAttributeContainer
    FabricDefaultAttributeRegistry.register(TRICKY, TrickyEntity.createTrickyAttributes());
    Tricky.LOGGER.info("Registering Mod Entities for " + Tricky.MOD_ID);
}

}

bronze arch
#

Well, the .build() function needs a parameter

hollow arch
#

How should I add it?

#

And what should I add as a parameter?

bronze arch
#

Intellij normaly shows you what you need to pass...

hollow arch
#

hmm

#

thanks

bronze arch
#

I'd guess it's some kind of RegistryKey

hollow arch
#

it doesn't tell me

bronze arch
#

If you hover over it or retype .build it should show it

#

Also this Method is deprecated, so you might want to switch to another Method...

gentle river
#

!!learnjava