Search in sources :

Example 1 with EntityType

use of net.minecraft.world.entity.EntityType in project MyPet by xXKeyleXx.

the class EntityRegistry method registerEntityType.

protected void registerEntityType(MyPetType petType, String key, DefaultedRegistry<EntityType<?>> entityRegistry) {
    EntityDimensions size = entityRegistry.get(new ResourceLocation(key.toLowerCase())).getDimensions();
    entityTypes.put(petType, Registry.register(entityRegistry, "mypet_" + key.toLowerCase(), EntityType.Builder.createNothing(MobCategory.CREATURE).noSave().noSummon().sized(size.width, size.height).build(key)));
    EntityType<? extends LivingEntity> types = (EntityType<? extends LivingEntity>) entityRegistry.get(new ResourceLocation(key));
    registerDefaultAttributes(entityTypes.get(petType), types);
    overwriteEntityID(entityTypes.get(petType), getEntityTypeId(petType, entityRegistry), entityRegistry);
}
Also used : EntityType(net.minecraft.world.entity.EntityType) LivingEntity(net.minecraft.world.entity.LivingEntity) EntityDimensions(net.minecraft.world.entity.EntityDimensions) ResourceLocation(net.minecraft.resources.ResourceLocation)

Example 2 with EntityType

use of net.minecraft.world.entity.EntityType in project MyPet by xXKeyleXx.

the class EntityRegistry method registerEntityType.

protected void registerEntityType(MyPetType petType, String key, DefaultedRegistry<EntityType<?>> entityRegistry) {
    EntityDimensions size = entityRegistry.get(new ResourceLocation(key.toLowerCase())).getDimensions();
    entityTypes.put(petType, Registry.register(entityRegistry, "mypet_" + key.toLowerCase(), EntityType.Builder.createNothing(MobCategory.CREATURE).noSave().noSummon().sized(size.width, size.height).build(key)));
    EntityType<? extends LivingEntity> types = (EntityType<? extends LivingEntity>) entityRegistry.get(new ResourceLocation(key));
    registerDefaultAttributes(entityTypes.get(petType), types);
    overwriteEntityID(entityTypes.get(petType), getEntityTypeId(petType, entityRegistry), entityRegistry);
}
Also used : EntityType(net.minecraft.world.entity.EntityType) LivingEntity(net.minecraft.world.entity.LivingEntity) EntityDimensions(net.minecraft.world.entity.EntityDimensions) ResourceLocation(net.minecraft.resources.ResourceLocation)

Aggregations

ResourceLocation (net.minecraft.resources.ResourceLocation)2 EntityDimensions (net.minecraft.world.entity.EntityDimensions)2 EntityType (net.minecraft.world.entity.EntityType)2 LivingEntity (net.minecraft.world.entity.LivingEntity)2