summary refs log blame commit diff stats
path: root/src/main/java/ganarchy/chewstuff/ChewComponents.java
blob: 427d86e495d84a818e96a0a77f49e8f60a1d10ba (plain) (tree)



























                                                                                
package ganarchy.chewstuff;

import dev.onyxstudios.cca.api.v3.component.ComponentKey;
import dev.onyxstudios.cca.api.v3.component.ComponentRegistry;
import dev.onyxstudios.cca.api.v3.entity.EntityComponentFactoryRegistry;
import dev.onyxstudios.cca.api.v3.entity.EntityComponentInitializer;
import dev.onyxstudios.cca.api.v3.entity.RespawnCopyStrategy;
import net.minecraft.entity.LivingEntity;
import net.minecraft.util.Identifier;

public class ChewComponents implements EntityComponentInitializer {
    public static final ComponentKey<ChewComponent> CHEW =
        ComponentRegistry.getOrCreate(
            new Identifier("chewstuff", "chew"), ChewComponent.class
        );

    @Override
    public void registerEntityComponentFactories(
        EntityComponentFactoryRegistry registry
    ) {
        registry.registerFor(
            LivingEntity.class, CHEW, entity -> new ChewComponent()
        );
        registry.registerForPlayers(
            CHEW, entity -> new ChewComponent(), RespawnCopyStrategy.ALWAYS_COPY
        );
    }
}