Fabric API

Fabric API

106M Downloads

cant summon custom entity

sheeeev66 opened this issue ยท 3 comments

commented

I was attempting to add a new entity, I followed the tutorial, and it didn't work. after 5 hours of continuous testing, it still didn't work! so please tell me if I understood the tutorial correctly.

the code:

package net.star.wars.materials.entities;

import net.fabricmc.fabric.api.object.builder.v1.entity.FabricEntityTypeBuilder;
import net.minecraft.entity.EntityCategory;
import net.minecraft.entity.EntityDimensions;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.passive.ChickenEntity;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
import net.minecraft.world.World;

public class PorgEntity extends ChickenEntity {

    public PorgEntity(EntityType<? extends ChickenEntity> entityType, World world) {
		super(entityType, world);
	}
	
	public static final EntityType<PorgEntity> PORG =
    Registry.register(
        Registry.ENTITY_TYPE,
        new Identifier("starwarsmaterials", "porg"),
        FabricEntityTypeBuilder.create(EntityCategory.AMBIENT, PorgEntity::new).dimensions(EntityDimensions.fixed(1, 2)).build()
    );
}
commented

Hey! I would not do your registry for the Porg in your entity class. You should rather do it in the class that implements ModInitializer or a class dedicated for all your entities. Is this 1.15 or 1.16?

commented

Also, this is Fabric API. Not a help page. I would recommend you to ask around in fabricord (fabric discord) for help rather than in the API page.

commented

its 1.15.2
ok thank you i will keep that in mind