Class VillagerProfessionBuilder
VillagerProfession
s.
The texture for the villagers are located at assets/IDENTIFIER_NAMESPACE/textures/entity/villager/profession/IDENTIFIER_PATH.png
A corresponding IDENTIFIER_PATH.mcmeta
file exits in the same directory to define properties such as the HatType
this profession would use.
Note this does not register any trades to these villagers. To register trades, add a new entry with your profession as the key to TradeOffers.PROFESSION_TO_LEVELED_TRADE
.
-
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.village.VillagerProfession
build()
Creates theVillagerProfession
.static VillagerProfessionBuilder
create()
Creates a builder instance to allow for creation of aVillagerProfession
.harvestableItems(Iterable<net.minecraft.item.Item> items)
Items that a Villager may harvest in this profession.harvestableItems(net.minecraft.item.Item... items)
Items that a Villager may harvest in this profession.id(net.minecraft.util.Identifier id)
The Identifier used to identify this villager profession.secondaryJobSites(Iterable<net.minecraft.block.Block> blocks)
A collection of blocks blocks which may suffice as a secondary job site for a Villager.secondaryJobSites(net.minecraft.block.Block... blocks)
A collection of blocks blocks which may suffice as a secondary job site for a Villager.workSound(@Nullable net.minecraft.sound.SoundEvent workSoundEvent)
Provides the sound made when a Villager works.workstation(net.minecraft.world.poi.PointOfInterestType type)
ThePointOfInterestType
the Villager of this profession will search for when finding a workstation.
-
Method Details
-
create
Creates a builder instance to allow for creation of aVillagerProfession
.- Returns:
- A new builder.
-
id
The Identifier used to identify this villager profession.- Parameters:
id
- The identifier to assign to this profession.- Returns:
- this builder
-
workstation
ThePointOfInterestType
the Villager of this profession will search for when finding a workstation.- Parameters:
type
- ThePointOfInterestType
the Villager will attempt to find.- Returns:
- this builder.
-
harvestableItems
Items that a Villager may harvest in this profession.In Vanilla, this is used by the farmer to define what type of crops the farmer can harvest.
- Parameters:
items
- Items harvestable by this profession.- Returns:
- this builder.
-
harvestableItems
Items that a Villager may harvest in this profession.In Vanilla, this is used by the farmer to define what type of crops the farmer can harvest.
- Parameters:
items
- Items harvestable by this profession.- Returns:
- this builder.
-
secondaryJobSites
A collection of blocks blocks which may suffice as a secondary job site for a Villager.In Vanilla, this is used by the
Farmer
to stay nearFarmland
when at it's job site.- Parameters:
blocks
- Collection of secondary job site blocks.- Returns:
- this builder.
-
secondaryJobSites
A collection of blocks blocks which may suffice as a secondary job site for a Villager.In Vanilla, this is used by the
Farmer
to stay nearFarmland
when at it's job site.- Parameters:
blocks
- Collection of secondary job site blocks.- Returns:
- this builder.
-
workSound
public VillagerProfessionBuilder workSound(@Nullable @Nullable net.minecraft.sound.SoundEvent workSoundEvent)Provides the sound made when a Villager works.- Parameters:
workSoundEvent
- TheSoundEvent
to be played.- Returns:
- this builder.
-
build
public net.minecraft.village.VillagerProfession build()Creates theVillagerProfession
.- Returns:
- a new
VillagerProfession
. - Throws:
IllegalStateException
- if the builder is missing anid
andworkstation
.
-