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.jobSite
(Predicate<net.minecraft.util.registry.RegistryEntry<net.minecraft.world.poi.PointOfInterestType>> predicate) 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
(Predicate<net.minecraft.util.registry.RegistryEntry<net.minecraft.world.poi.PointOfInterestType>> predicate) ThePointOfInterestType
the Villager of this profession will search for when finding a workstation.workstation
(net.minecraft.util.registry.RegistryKey<net.minecraft.world.poi.PointOfInterestType> key) 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
public VillagerProfessionBuilder workstation(net.minecraft.util.registry.RegistryKey<net.minecraft.world.poi.PointOfInterestType> key) ThePointOfInterestType
the Villager of this profession will search for when finding a workstation.- Parameters:
key
- ThePointOfInterestType
the Villager will attempt to find.- Returns:
- this builder.
-
workstation
public VillagerProfessionBuilder workstation(Predicate<net.minecraft.util.registry.RegistryEntry<net.minecraft.world.poi.PointOfInterestType>> predicate) ThePointOfInterestType
the Villager of this profession will search for when finding a workstation.- Parameters:
predicate
- ThePointOfInterestType
the Villager will attempt to find.- Returns:
- this builder.
-
jobSite
public VillagerProfessionBuilder jobSite(Predicate<net.minecraft.util.registry.RegistryEntry<net.minecraft.world.poi.PointOfInterestType>> predicate) -
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
.
-