appjackstudio Posted August 5, 2019 Share Posted August 5, 2019 (edited) I am trying to create a custom "Baker" villager type but am having trouble getting it to be created naturally. I am able to summon a baker villager with "/summon minecraft:villager 92.70 63.00 214.65 {Brain: {memories: {"minecraft:job_site": {pos: [I; 91, 63, 214], dimension: "minecraft:overworld"}}}, VillagerData: {profession: "bakecraft:baker"}}", but it converts into an unemployed villager as soon as it turns time hits 2000. I have double-checked and the job site coordinates are correct. I cannot get one to generate naturally by putting it next to the workstation. I know the profession and POI are registered properly because they show up in the registry while debugging. What am I missing? Why aren't the villagers recognizing their workstations? Any help is appreciated. Thanks! package com.appjackstudio.bakecraft.init; import com.google.common.collect.ImmutableSet; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.entity.merchant.villager.VillagerProfession; import net.minecraft.util.SoundEvent; import net.minecraft.village.PointOfInterestType; import net.minecraftforge.registries.IForgeRegistry; import java.util.Set; public class ModVillagers { public static Set<BlockState> getAllStates(Block block) { return ImmutableSet.copyOf(block.getStateContainer().getValidStates()); } public static final PointOfInterestType OVEN = new PointOfInterestType("oven", getAllStates(ModBlocks.TRONA), 1, (SoundEvent)null, 1).setRegistryName("oven"); public static void registerPointOfIntrestTypes(IForgeRegistry<PointOfInterestType> registry){ registry.registerAll( OVEN ); } public static final VillagerProfession BAKER = new VillagerProfession("baker", OVEN, ImmutableSet.of(), ImmutableSet.of()).setRegistryName("baker"); public static void registerVillagerProfessions(IForgeRegistry<VillagerProfession> registry){ registry.registerAll( BAKER ); } } Edited August 5, 2019 by appjackstudio Full Code Quote Link to comment Share on other sites More sharing options...
Animefan8888 Posted August 5, 2019 Share Posted August 5, 2019 30 minutes ago, appjackstudio said: public static final PointOfInterestType OVEN = new PointOfInterestType("oven", getAllStates(ModBlocks.OVEN), 1, (SoundEvent)null, 1).setRegistryName("oven"); First off don't initialize any Registry entries in a static initializer. 35 minutes ago, appjackstudio said: getAllStates What does this method do? Quote VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator. Link to comment Share on other sites More sharing options...
appjackstudio Posted August 5, 2019 Author Share Posted August 5, 2019 1 hour ago, Animefan8888 said: First off don't initialize any Registry entries in a static initializer. All mods I've seen and the all the vanilla classes do it that way. What would be the recommended way of doing it? 1 hour ago, Animefan8888 said: What does this method do? I've updated the post to contain the full code Quote Link to comment Share on other sites More sharing options...
Animefan8888 Posted August 5, 2019 Share Posted August 5, 2019 Just now, appjackstudio said: All mods I've seen and the all the vanilla classes do it that way. What would be the recommended way of doing it? You should do it in the their registry event and on top of your fields put the @ObjectHolder annotation. 2 hours ago, appjackstudio said: public class ModVillagers { You don't have the EventBusSubscriber annotation here so I assume you are registering the class in your setup method? Quote VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator. Link to comment Share on other sites More sharing options...
appjackstudio Posted August 5, 2019 Author Share Posted August 5, 2019 3 minutes ago, Animefan8888 said: You should do it in the their registry event and on top of your fields put the @ObjectHolder annotation. Like This? @ObjectHolder("bakecraft") public class ModVillagers { public static Set<BlockState> getAllStates(Block block) { return ImmutableSet.copyOf(block.getStateContainer().getValidStates()); } public static final PointOfInterestType oven = null; public static void registerPointOfIntrestTypes(IForgeRegistry<PointOfInterestType> registry){ BakecraftMod.LOGGER.info(getAllStates(ModBlocks.TRONA)); registry.registerAll( new PointOfInterestType("oven", getAllStates(ModBlocks.TRONA), 1, (SoundEvent)null, 1).setRegistryName("oven") ); } public static final VillagerProfession baker = null; public static void registerVillagerProfessions(IForgeRegistry<VillagerProfession> registry){ registry.registerAll( new VillagerProfession("baker", oven, ImmutableSet.of(), ImmutableSet.of()).setRegistryName("baker") ); } } 3 minutes ago, Animefan8888 said: You don't have the EventBusSubscriber annotation here so I assume you are registering the class in your setup method? Yes // ... @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD) public static class RegistryEvents { // ... @SubscribeEvent public static void onPointsOfInterestTypeRegistry(final RegistryEvent.Register<PointOfInterestType> event){ LOGGER.info("Registering Points of Interest"); ModVillagers.registerPointOfIntrestTypes(event.getRegistry()); } @SubscribeEvent public static void onVillagerProfessionRegistry(final RegistryEvent.Register<VillagerProfession> event){ LOGGER.info("Registering Villager Professions"); ModVillagers.registerVillagerProfessions(event.getRegistry()); } } // ... Quote Link to comment Share on other sites More sharing options...
Animefan8888 Posted August 5, 2019 Share Posted August 5, 2019 2 minutes ago, appjackstudio said: Like This? That looks good. 7 minutes ago, appjackstudio said: getAllStates(ModBlocks.TRONA) Can we confirm that this set isn't empty. Quote VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator. Link to comment Share on other sites More sharing options...
appjackstudio Posted August 5, 2019 Author Share Posted August 5, 2019 1 minute ago, Animefan8888 said: Can we confirm that this set isn't empty. Quote Link to comment Share on other sites More sharing options...
Animefan8888 Posted August 5, 2019 Share Posted August 5, 2019 47 minutes ago, appjackstudio said: I'm not sure what is going on maybe it was a bug and has been fixed have you tried updating to the latest forge version. Quote VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect. Forge and vanilla BlockState generator. Link to comment Share on other sites More sharing options...
appjackstudio Posted August 5, 2019 Author Share Posted August 5, 2019 9 minutes ago, Animefan8888 said: I'm not sure what is going on maybe it was a bug and has been fixed have you tried updating to the latest forge version. Just updated to 1.14.4-28.0.41, didn't fix it. I also updated the MCP mappings. Quote Link to comment Share on other sites More sharing options...
henkelmax Posted August 31, 2019 Share Posted August 31, 2019 I have the same issue. Has someone reported this in the bug tracker? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.