-
Notifications
You must be signed in to change notification settings - Fork 0
Trader
Linguardium edited this page Apr 25, 2020
·
8 revisions
Trader objects define the settings for a type of trader that can be generated.
To create a trader object, use the makeTrader()
function.
name(String)
(Optional) sets the name of this trader type. This value is translatable and will either provide the value from the lang file or the value directly if it is missing from the lang file. defaults to "Tradesman"
example: makeTrader().name("One Eye'd Joe")
example: makeTrader().name("npc.tradesmen.joe.name")
animal(String)
animal(String, Integer)
(Optional) sets the animal id and number of animals that will be spawned with this trader. defaults to "minecraft:trader_llama" and 1
godMode()
godMode(Boolean)
Sets the trader to be invulnerable to most things (falling into the void and creative players can still damage it).
Mobs will not chase/pay attention to an invulnerable trader.
texture(String)
(Optional) sets the base skin texture for this trader type. defaults to "tradesmen:textures/entity/skivvies.png"
example: makeTrader().texture("minecraft:textures/entity/wandering_trader.png")
oldNose(Boolean)
(Optional) sets the nose on the trader to be the old Ood style nose rather than the new button nose style I am using.
defaults to false.
example: makeTrader().oldNose(true)
clothes(String)
(Optional) sets the second texture layer for this trader type. A blank string will clear this layer. defaults to "minecraft:textures/entity/wandering_trader.png"
example: makeTrader().clothes("minecraft:textures/entity/villager/type/jungle.png")
clothes(Integer)
clothes(Integer[])
clothes(Float[])
(Optional) sets the color shift of the clothes texture layer. defaults to [255,255,255] (white, no color shift)
Integer value is in the form of RGB bytes, where Red is the Most Significant Byte
example: makeTrader().clothes(0xFF9696)
example: makeTrader().clothes([255,150,150])
example: makeTrader().clothes([1.0,0.5,0.5])
clothes(String, Integer)
clothes(String, Integer[])
clothes(Float[])
(Optional) combines the above methods
hat(String)
(Optional) sets the third texture layer for this trader. defaults to "".
example: makeTrader().hat("tradesmen:textures/entity/hats/eyepatch.png")
hat(Integer)
hat(Integer[])
hat(Float[])
(Optional) sets the color shift of the third texture layer. defaults to [255,255,255] (white, no color shift)
for example usage, see clothes(Integer)
hat(String, Integer)
hat(String, Integer[])
hat(String, Float[])
(Optional) combines the above methods
tiered()
tiered(Boolean)
(Optional) sets whether this trader has tiered trade progression. If tiered, the trader will be randomly assigned a tier when spawned. If tiered, the trader will automatically be given the tier specific badge (up to diamond for 5+). defaults to false (not tier limited)
setTrades(Array[Trades[]], Integer[])
(Required) sets the trades for this trader type and the number of items to pick from each tier.
Example: .setTrades([[ TradeObject1, TradeObject2],[TradeObject3]],[1,1])
Example: The above example has 2 tiers of trades. 2 trades are in the first tier, 1 trade in the 2nd. Each tier will randomly select 1 trade from that tier list to offer to the player. Vanilla uses a [2,2,2,2,2] pattern for tier counts.
for more example usage, see the example js files for librarian, armorer, or leatherworker.
*** NOTE *** if trades are not set, the trader will still be spawned but interacting with them will do nothing. The trader will act as though they are a profession-less villager.