Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

TimmyRB

Members
  • Joined

  • Last visited

  1. 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!
  2. Thanks so much! That fixed it for me.
  3. TimmyRB joined the community
  4. I'm quite new at modding so bear with me here, I'm trying to register my Entity using the DeferredRegister but I keep getting the error "The type DeerEntity does not define DeerEntity(EntityType<T>, World) that is applicable here" // RegistryHandler.java public static final DeferredRegister<EntityType<?>> ENTITY_TYPES = DeferredRegister.create(ForgeRegistries.ENTITIES, HuntingUpdate.MOD_ID); public static final RegistryObject<EntityType<DeerEntity>> DEER = ENTITY_TYPES.register("deer", () -> EntityType.Builder.create(DeerEntity::new, EntityClassification.CREATURE) .size(1.0f, 1.0f) .build(new ResourceLocation(HuntingUpdate.MOD_ID, "deer").toString())); // DeerEntity.java public class DeerEntity extends AnimalEntity { public static final Ingredient TEMPTATION_ITEMS = Ingredient.fromItems(Items.APPLE, Items.CARROT, Items.CARROT_ON_A_STICK, Items.BEETROOT); private EatGrassGoal eatGrassGoal; private int deerTimer; protected DeerEntity(EntityType<? extends DeerEntity> type, World worldIn) { super(type, worldIn); // TODO Auto-generated constructor stub } public static AttributeModifierMap.MutableAttribute setCustomAttributes() { return AnimalEntity.func_233666_p_().func_233815_a_(Attributes.field_233818_a_, 10.0D) // Max Health .func_233815_a_(Attributes.field_233821_d_, 0.3D); // Movement Speed } @Override protected void registerGoals() { super.registerGoals(); this.goalSelector.addGoal(0, new SwimGoal(this)); this.goalSelector.addGoal(1, new PanicGoal(this, 1.5D)); this.goalSelector.addGoal(2, new BreedGoal(this, 1.0D)); this.goalSelector.addGoal(3, new TemptGoal(this, 0.5D, TEMPTATION_ITEMS, true)); this.goalSelector.addGoal(4, new FollowParentGoal(this, 1.1D)); this.goalSelector.addGoal(5, eatGrassGoal); this.goalSelector.addGoal(6, new AvoidEntityGoal<>(this, PlayerEntity.class, 15.0F, 1.25D, 0.5D)); this.goalSelector.addGoal(7, new WaterAvoidingRandomWalkingGoal(this, 0.7D)); this.goalSelector.addGoal(8, new LookAtGoal(this, PlayerEntity.class, 10.0F)); this.goalSelector.addGoal(9, new LookRandomlyGoal(this)); } @Override public AgeableEntity func_241840_a(ServerWorld p_241840_1_, AgeableEntity p_241840_2_) { return RegistryHandler.DEER.get().create(this.world); } @Override protected int getExperiencePoints(PlayerEntity player) { return 1 + this.world.rand.nextInt(4); } @Override protected SoundEvent getAmbientSound() { return SoundEvents.ENTITY_SQUID_AMBIENT; } @Override protected SoundEvent getDeathSound() { return SoundEvents.ENTITY_SQUID_DEATH; } @Override protected SoundEvent getHurtSound(DamageSource damageSourceIn) { return SoundEvents.ENTITY_SQUID_HURT; } @Override protected void playStepSound(BlockPos pos, BlockState blockIn) { this.playSound(SoundEvents.ENTITY_SQUID_SQUIRT, 0.15F, 1.0F); } @Override protected void updateAITasks() { this.deerTimer = this.eatGrassGoal.getEatingGrassTimer(); super.updateAITasks(); } @Override public void livingTick() { if (this.world.isRemote) { this.deerTimer = Math.max(0, this.deerTimer - 1); } super.livingTick(); } @OnlyIn(Dist.CLIENT) public void handleStatusUpdate(byte id) { if (id == 10) { this.deerTimer = 40; } else { super.handleStatusUpdate(id); } } } Any help would be greatly appreciated!

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.