Posted October 22, 20205 yr I'm trying to register a custom Villager Profession but I'm not sure if what I'm doing is correct. The following runs without a hitch however the villagers never run the the block like they do other Job blocks and even if they are getting the job when I'm not looking, I'm unsure how to set a custom texture so they appear uniquely. // ModProfessions.java public class ModProfessions { public static final DeferredRegister<VillagerProfession> PROFESSIONS = DeferredRegister .create(ForgeRegistries.PROFESSIONS, HuntingUpdate.MOD_ID); private static final ImmutableSet<Item> HUNTER_ITEMS = ImmutableSet.of(Items.BEEF, Items.PORKCHOP, Items.CHICKEN, Items.RABBIT, Items.RABBIT_HIDE, Items.MUTTON, Items.LEATHER, Items.COOKED_BEEF, Items.COOKED_PORKCHOP, Items.COOKED_CHICKEN, Items.COOKED_RABBIT, Items.COOKED_MUTTON); public static final RegistryObject<VillagerProfession> HUNTER = PROFESSIONS.register("hunter", () -> new VillagerProfession("hunter", new PointOfInterestType("hunting_table", ImmutableSet.of(ModBlocks.HUNTING_TABLE.get().getDefaultState()), 5, 40), HUNTER_ITEMS, ImmutableSet.of(ModBlocks.HUNTING_TABLE.get()), SoundEvents.ENTITY_VILLAGER_WORK_BUTCHER)); } // HuntingUpdate.java (Main Class) public HuntingUpdate() { // Register the setup method for modloading FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup); // Register the doClientStuff method for modloading FMLJavaModLoadingContext.get().getModEventBus().addListener(this::doClientStuff); ModBlocks.BLOCKS.register(FMLJavaModLoadingContext.get().getModEventBus()); ModItems.ITEMS.register(FMLJavaModLoadingContext.get().getModEventBus()); ModEntities.ENTITY_TYPES.register(FMLJavaModLoadingContext.get().getModEventBus()); ModProfessions.PROFESSIONS.register(FMLJavaModLoadingContext.get().getModEventBus()); // Register ourselves for server and other game events we are interested in MinecraftForge.EVENT_BUS.register(this); } Any help would be super appreciated thanks!
October 23, 20205 yr I would take a look at how the Never Needed or Wanted (NNOW) mod handles new villagers, PoI blocks, and trades. The unique villager textures are based on the names when you register the profession (here), which points to the corresponding file in your textures/entity. The mod creator also made some nifty reference classes, VillagerUtil and RandomTradeBuilder, that reduces some repetitive code when making multiple villager types. Edited October 23, 20205 yr by urbanxx001
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.