TradeRebalanceChestLoot .java

net.minecraft.data.loot.packs.TradeRebalanceChestLoot (class): members: pillagerOutpostLootTable, desertPyramidLootTable, jungleTempleLootTable, biomes.

net.minecraft.data.loot.packsclass305 linescommon18.7 KB

Implements

API Surface (5)

void run()
LootTable.Builder pillagerOutpostLootTable()
LootTable.Builder desertPyramidLootTable()
LootTable.Builder ancientCityLootTable()
LootTable.Builder jungleTempleLootTable()

Fields & Constants (4)

output
enchantments
biomes
instruments

Full Source

TradeRebalanceChestLoot.java305 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.data.loot.packs;
2
3
import net.minecraft.advancements.predicates.LocationPredicate;
4
import net.minecraft.core.HolderGetter;
5
import net.minecraft.core.HolderSet;
6
import net.minecraft.core.registries.Registries;
7
import net.minecraft.data.loot.LootTableSubProvider;
8
import net.minecraft.tags.InstrumentTags;
9
import net.minecraft.world.item.Instrument;
10
import net.minecraft.world.item.Items;
11
import net.minecraft.world.item.alchemy.Potions;
12
import net.minecraft.world.item.enchantment.Enchantment;
13
import net.minecraft.world.item.enchantment.Enchantments;
14
import net.minecraft.world.level.biome.Biome;
15
import net.minecraft.world.level.biome.Biomes;
16
import net.minecraft.world.level.block.Blocks;
17
import net.minecraft.world.level.storage.loot.BuiltInLootTables;
18
import net.minecraft.world.level.storage.loot.LootPool;
19
import net.minecraft.world.level.storage.loot.LootTable;
20
import net.minecraft.world.level.storage.loot.entries.EmptyLootItem;
21
import net.minecraft.world.level.storage.loot.entries.LootItem;
22
import net.minecraft.world.level.storage.loot.functions.EnchantRandomlyFunction;
23
import net.minecraft.world.level.storage.loot.functions.EnchantWithLevelsFunction;
24
import net.minecraft.world.level.storage.loot.functions.SetInstrumentFunction;
25
import net.minecraft.world.level.storage.loot.functions.SetItemCountFunction;
26
import net.minecraft.world.level.storage.loot.functions.SetItemDamageFunction;
27
import net.minecraft.world.level.storage.loot.functions.SetPotionFunction;
28
import net.minecraft.world.level.storage.loot.predicates.LocationCheck;
29
import net.minecraft.world.level.storage.loot.providers.number.floats.ContextFloatProviders;
30
import net.minecraft.world.level.storage.loot.providers.number.ints.ContextIntProviders;
31
32
public class TradeRebalanceChestLoot implements LootTableSubProvider {
33
	private final LootTableSubProvider.Context output;
34
	private final HolderGetter<Enchantment> enchantments;
35
	private final HolderGetter<Biome> biomes;
36
	private final HolderGetter<Instrument> instruments;
37
38
	public TradeRebalanceChestLoot(final LootTableSubProvider.Context output) {
39
		this.output = output;
40
		this.enchantments = output.lookup(Registries.ENCHANTMENT);
41
		this.biomes = output.lookup(Registries.BIOME);
42
		this.instruments = output.lookup(Registries.INSTRUMENT);
43
	}
44
45
	@Override
46
	public void run() {
47
		this.output
48
			.accept(
49
				BuiltInLootTables.ABANDONED_MINESHAFT,
50
				LootTable.lootTable()
51
					.withPool(
52
						LootPool.lootPool()
53
							.setRolls(ContextIntProviders.exactly(1))
54
							.add(LootItem.lootTableItem(Items.GOLDEN_APPLE).setWeight(20))
55
							.add(LootItem.lootTableItem(Items.ENCHANTED_GOLDEN_APPLE))
56
							.add(LootItem.lootTableItem(Items.NAME_TAG).setWeight(30))
57
							.add(LootItem.lootTableItem(Items.BOOK).setWeight(10).apply(EnchantRandomlyFunction.randomApplicableEnchantment(this.enchantments)))
58
							.add(LootItem.lootTableItem(Items.IRON_PICKAXE).setWeight(5))
59
							.add(EmptyLootItem.emptyItem().setWeight(5))
60
					)
61
					.withPool(
62
						LootPool.lootPool()
63
							.setRolls(ContextIntProviders.between(2, 4))
64
							.add(LootItem.lootTableItem(Items.IRON_INGOT).setWeight(10).apply(SetItemCountFunction.setCount(ContextIntProviders.between(1, 5))))
65
							.add(LootItem.lootTableItem(Items.GOLD_INGOT).setWeight(5).apply(SetItemCountFunction.setCount(ContextIntProviders.between(1, 3))))
66
							.add(LootItem.lootTableItem(Items.REDSTONE).setWeight(5).apply(SetItemCountFunction.setCount(ContextIntProviders.between(4, 9))))
67
							.add(LootItem.lootTableItem(Items.LAPIS_LAZULI).setWeight(5).apply(SetItemCountFunction.setCount(ContextIntProviders.between(4, 9))))
68
							.add(LootItem.lootTableItem(Items.DIAMOND).setWeight(3).apply(SetItemCountFunction.setCount(ContextIntProviders.between(1, 2))))
69
							.add(LootItem.lootTableItem(Items.COAL).setWeight(10).apply(SetItemCountFunction.setCount(ContextIntProviders.between(3, 8))))
70
							.add(LootItem.lootTableItem(Items.BREAD).setWeight(15).apply(SetItemCountFunction.setCount(ContextIntProviders.between(1, 3))))
71
							.add(LootItem.lootTableItem(Items.GLOW_BERRIES).setWeight(15).apply(SetItemCountFunction.setCount(ContextIntProviders.between(3, 6))))
72
							.add(LootItem.lootTableItem(Items.MELON_SEEDS).setWeight(10).apply(SetItemCountFunction.setCount(ContextIntProviders.between(2, 4))))
73
							.add(LootItem.lootTableItem(Items.PUMPKIN_SEEDS).setWeight(10).apply(SetItemCountFunction.setCount(ContextIntProviders.between(2, 4))))
74
							.add(LootItem.lootTableItem(Items.BEETROOT_SEEDS).setWeight(10).apply(SetItemCountFunction.setCount(ContextIntProviders.between(2, 4))))
75
					)
76
					.withPool(
77
						LootPool.lootPool()
78
							.setRolls(ContextIntProviders.exactly(3))
79
							.add(LootItem.lootTableItem(Blocks.RAIL).setWeight(20).apply(SetItemCountFunction.setCount(ContextIntProviders.between(4, 8))))
80
							.add(LootItem.lootTableItem(Blocks.POWERED_RAIL).setWeight(5).apply(SetItemCountFunction.setCount(ContextIntProviders.between(1, 4))))
81
							.add(LootItem.lootTableItem(Blocks.DETECTOR_RAIL).setWeight(5).apply(SetItemCountFunction.setCount(ContextIntProviders.between(1, 4))))
82
							.add(LootItem.lootTableItem(Blocks.ACTIVATOR_RAIL).setWeight(5).apply(SetItemCountFunction.setCount(ContextIntProviders.between(1, 4))))
83
							.add(LootItem.lootTableItem(Blocks.TORCH).setWeight(15).apply(SetItemCountFunction.setCount(ContextIntProviders.between(1, 16))))
84
							.add(
85
								LootItem.lootTableItem(Items.MUSIC_DISC_BOUNCE)
86
									.when(LocationCheck.checkLocation(LocationPredicate.Builder.location().setBiomes(HolderSet.direct(this.biomes.getOrThrow(Biomes.SULFUR_CAVES)))))
87
									.setWeight(10)
88
							)
89
					)
90
					.withPool(
91
						LootPool.lootPool()
92
							.setRolls(ContextIntProviders.exactly(1))
93
							.add(EmptyLootItem.emptyItem().setWeight(4))
94
							.add(
95
								LootItem.lootTableItem(Items.BOOK)
96
									.setWeight(1)
97
									.apply(new EnchantRandomlyFunction.Builder().withEnchantment(this.enchantments.getOrThrow(Enchantments.EFFICIENCY)))
98
							)
99
					)
100
			);
101
		this.output.accept(BuiltInLootTables.ANCIENT_CITY, this.ancientCityLootTable());
102
		this.output.accept(BuiltInLootTables.DESERT_PYRAMID, this.desertPyramidLootTable());
103
		this.output.accept(BuiltInLootTables.JUNGLE_TEMPLE, this.jungleTempleLootTable());
104
		this.output.accept(BuiltInLootTables.PILLAGER_OUTPOST, this.pillagerOutpostLootTable());
105
	}
106
107
	public LootTable.Builder pillagerOutpostLootTable() {
108
		return LootTable.lootTable()
109
			.withPool(LootPool.lootPool().setRolls(ContextIntProviders.between(0, 1)).add(LootItem.lootTableItem(Items.CROSSBOW)))
110
			.withPool(
111
				LootPool.lootPool()
112
					.setRolls(ContextIntProviders.between(2, 3))
113
					.add(LootItem.lootTableItem(Items.WHEAT).setWeight(7).apply(SetItemCountFunction.setCount(ContextIntProviders.between(3, 5))))
114
					.add(LootItem.lootTableItem(Items.POTATO).setWeight(5).apply(SetItemCountFunction.setCount(ContextIntProviders.between(2, 5))))
115
					.add(LootItem.lootTableItem(Items.CARROT).setWeight(5).apply(SetItemCountFunction.setCount(ContextIntProviders.between(3, 5))))
116
			)
117
			.withPool(
118
				LootPool.lootPool()
119
					.setRolls(ContextIntProviders.between(1, 3))
120
					.add(LootItem.lootTableItem(Blocks.DARK_OAK_LOG).apply(SetItemCountFunction.setCount(ContextIntProviders.between(2, 3))))
121
			)
122
			.withPool(
123
				LootPool.lootPool()
124
					.setRolls(ContextIntProviders.between(2, 3))
125
					.add(LootItem.lootTableItem(Items.EXPERIENCE_BOTTLE).setWeight(7))
126
					.add(LootItem.lootTableItem(Items.STRING).setWeight(4).apply(SetItemCountFunction.setCount(ContextIntProviders.between(1, 6))))
127
					.add(LootItem.lootTableItem(Items.ARROW).setWeight(4).apply(SetItemCountFunction.setCount(ContextIntProviders.between(2, 7))))
128
					.add(LootItem.lootTableItem(Items.TRIPWIRE_HOOK).setWeight(3).apply(SetItemCountFunction.setCount(ContextIntProviders.between(1, 3))))
129
					.add(LootItem.lootTableItem(Items.IRON_INGOT).setWeight(3).apply(SetItemCountFunction.setCount(ContextIntProviders.between(1, 3))))
130
					.add(LootItem.lootTableItem(Items.BOOK).setWeight(1).apply(EnchantRandomlyFunction.randomApplicableEnchantment(this.enchantments)))
131
			)
132
			.withPool(
133
				LootPool.lootPool()
134
					.setRolls(ContextIntProviders.between(0, 1))
135
					.add(LootItem.lootTableItem(Items.GOAT_HORN))
136
					.apply(SetInstrumentFunction.setInstrumentOptions(this.instruments.getOrThrow(InstrumentTags.REGULAR_GOAT_HORNS)))
137
			)
138
			.withPool(
139
				LootPool.lootPool()
140
					.setRolls(ContextIntProviders.exactly(1))
141
					.add(EmptyLootItem.emptyItem().setWeight(3))
142
					.add(LootItem.lootTableItem(Items.SENTRY_ARMOR_TRIM_SMITHING_TEMPLATE).setWeight(1).apply(SetItemCountFunction.setCount(ContextIntProviders.exactly(2))))
143
			)
144
			.withPool(
145
				LootPool.lootPool()
146
					.setRolls(ContextIntProviders.exactly(1))
147
					.add(EmptyLootItem.emptyItem().setWeight(1))
148
					.add(
149
						LootItem.lootTableItem(Items.BOOK)
150
							.setWeight(2)
151
							.apply(new EnchantRandomlyFunction.Builder().withEnchantment(this.enchantments.getOrThrow(Enchantments.QUICK_CHARGE)))
152
					)
153
			);
154
	}
155
156
	public LootTable.Builder desertPyramidLootTable() {
157
		return LootTable.lootTable()
158
			.withPool(
159
				LootPool.lootPool()
160
					.setRolls(ContextIntProviders.between(2, 4))
161
					.add(LootItem.lootTableItem(Items.DIAMOND).setWeight(5).apply(SetItemCountFunction.setCount(ContextIntProviders.between(1, 3))))
162
					.add(LootItem.lootTableItem(Items.IRON_INGOT).setWeight(15).apply(SetItemCountFunction.setCount(ContextIntProviders.between(1, 5))))
163
					.add(LootItem.lootTableItem(Items.GOLD_INGOT).setWeight(15).apply(SetItemCountFunction.setCount(ContextIntProviders.between(2, 7))))
164
					.add(LootItem.lootTableItem(Items.EMERALD).setWeight(15).apply(SetItemCountFunction.setCount(ContextIntProviders.between(1, 3))))
165
					.add(LootItem.lootTableItem(Items.BONE).setWeight(25).apply(SetItemCountFunction.setCount(ContextIntProviders.between(4, 6))))
166
					.add(LootItem.lootTableItem(Items.SPIDER_EYE).setWeight(25).apply(SetItemCountFunction.setCount(ContextIntProviders.between(1, 3))))
167
					.add(LootItem.lootTableItem(Items.ROTTEN_FLESH).setWeight(25).apply(SetItemCountFunction.setCount(ContextIntProviders.between(3, 7))))
168
					.add(LootItem.lootTableItem(Items.SADDLE).setWeight(20))
169
					.add(LootItem.lootTableItem(Items.COPPER_HORSE_ARMOR).setWeight(15))
170
					.add(LootItem.lootTableItem(Items.IRON_HORSE_ARMOR).setWeight(15))
171
					.add(LootItem.lootTableItem(Items.GOLDEN_HORSE_ARMOR).setWeight(10))
172
					.add(LootItem.lootTableItem(Items.DIAMOND_HORSE_ARMOR).setWeight(5))
173
					.add(LootItem.lootTableItem(Items.BOOK).setWeight(10).apply(EnchantRandomlyFunction.randomApplicableEnchantment(this.enchantments)))
174
					.add(LootItem.lootTableItem(Items.GOLDEN_APPLE).setWeight(20))
175
					.add(LootItem.lootTableItem(Items.ENCHANTED_GOLDEN_APPLE).setWeight(2))
176
					.add(EmptyLootItem.emptyItem().setWeight(15))
177
			)
178
			.withPool(
179
				LootPool.lootPool()
180
					.setRolls(ContextIntProviders.exactly(4))
181
					.add(LootItem.lootTableItem(Items.BONE).setWeight(10).apply(SetItemCountFunction.setCount(ContextIntProviders.between(1, 8))))
182
					.add(LootItem.lootTableItem(Items.GUNPOWDER).setWeight(10).apply(SetItemCountFunction.setCount(ContextIntProviders.between(1, 8))))
183
					.add(LootItem.lootTableItem(Items.ROTTEN_FLESH).setWeight(10).apply(SetItemCountFunction.setCount(ContextIntProviders.between(1, 8))))
184
					.add(LootItem.lootTableItem(Items.STRING).setWeight(10).apply(SetItemCountFunction.setCount(ContextIntProviders.between(1, 8))))
185
					.add(LootItem.lootTableItem(Blocks.SAND).setWeight(10).apply(SetItemCountFunction.setCount(ContextIntProviders.between(1, 8))))
186
			)
187
			.withPool(
188
				LootPool.lootPool()
189
					.setRolls(ContextIntProviders.exactly(1))
190
					.add(EmptyLootItem.emptyItem().setWeight(4))
191
					.add(LootItem.lootTableItem(Items.DUNE_ARMOR_TRIM_SMITHING_TEMPLATE).setWeight(1).apply(SetItemCountFunction.setCount(ContextIntProviders.exactly(2))))
192
					.add(
193
						LootItem.lootTableItem(Items.BOOK)
194
							.setWeight(2)
195
							.apply(new EnchantRandomlyFunction.Builder().withEnchantment(this.enchantments.getOrThrow(Enchantments.UNBREAKING)))
196
					)
197
			);
198
	}
199
200
	public LootTable.Builder ancientCityLootTable() {
201
		return LootTable.lootTable()
202
			.withPool(
203
				LootPool.lootPool()
204
					.setRolls(ContextIntProviders.between(5, 10))
205
					.add(LootItem.lootTableItem(Items.ENCHANTED_GOLDEN_APPLE).setWeight(1).apply(SetItemCountFunction.setCount(ContextIntProviders.between(1, 2))))
206
					.add(LootItem.lootTableItem(Items.MUSIC_DISC_OTHERSIDE).setWeight(1))
207
					.add(LootItem.lootTableItem(Items.COMPASS).setWeight(2).apply(SetItemCountFunction.setCount(ContextIntProviders.exactly(1))))
208
					.add(LootItem.lootTableItem(Items.SCULK_CATALYST).setWeight(2).apply(SetItemCountFunction.setCount(ContextIntProviders.between(1, 2))))
209
					.add(
210
						LootItem.lootTableItem(Items.DIAMOND_HOE)
211
							.setWeight(2)
212
							.apply(SetItemCountFunction.setCount(ContextIntProviders.exactly(1)))
213
							.apply(SetItemDamageFunction.setDamage(ContextFloatProviders.between(0.8F, 1.0F)))
214
							.apply(EnchantWithLevelsFunction.enchantWithLevels(this.enchantments, ContextIntProviders.between(30, 50)))
215
					)
216
					.add(LootItem.lootTableItem(Items.LEAD).setWeight(2).apply(SetItemCountFunction.setCount(ContextIntProviders.exactly(1))))
217
					.add(LootItem.lootTableItem(Items.DIAMOND_HORSE_ARMOR).setWeight(2).apply(SetItemCountFunction.setCount(ContextIntProviders.exactly(1))))
218
					.add(LootItem.lootTableItem(Items.SADDLE).setWeight(2).apply(SetItemCountFunction.setCount(ContextIntProviders.exactly(1))))
219
					.add(LootItem.lootTableItem(Items.MUSIC_DISC_13).setWeight(2))
220
					.add(LootItem.lootTableItem(Items.MUSIC_DISC_CAT).setWeight(2))
221
					.add(
222
						LootItem.lootTableItem(Items.DIAMOND_LEGGINGS)
223
							.setWeight(2)
224
							.apply(EnchantWithLevelsFunction.enchantWithLevels(this.enchantments, ContextIntProviders.between(30, 50)))
225
					)
226
					.add(
227
						LootItem.lootTableItem(Items.BOOK)
228
							.setWeight(3)
229
							.apply(new EnchantRandomlyFunction.Builder().withEnchantment(this.enchantments.getOrThrow(Enchantments.SWIFT_SNEAK)))
230
					)
231
					.add(LootItem.lootTableItem(Items.SCULK).setWeight(3).apply(SetItemCountFunction.setCount(ContextIntProviders.between(4, 10))))
232
					.add(LootItem.lootTableItem(Items.SCULK_SENSOR).setWeight(3).apply(SetItemCountFunction.setCount(ContextIntProviders.between(1, 3))))
233
					.add(LootItem.lootTableItem(Items.CANDLE).setWeight(3).apply(SetItemCountFunction.setCount(ContextIntProviders.between(1, 4))))
234
					.add(LootItem.lootTableItem(Items.AMETHYST_SHARD).setWeight(3).apply(SetItemCountFunction.setCount(ContextIntProviders.between(1, 15))))
235
					.add(LootItem.lootTableItem(Items.EXPERIENCE_BOTTLE).setWeight(3).apply(SetItemCountFunction.setCount(ContextIntProviders.between(1, 3))))
236
					.add(LootItem.lootTableItem(Items.GLOW_BERRIES).setWeight(3).apply(SetItemCountFunction.setCount(ContextIntProviders.between(1, 15))))
237
					.add(
238
						LootItem.lootTableItem(Items.IRON_LEGGINGS)
239
							.setWeight(3)
240
							.apply(EnchantWithLevelsFunction.enchantWithLevels(this.enchantments, ContextIntProviders.between(20, 39)))
241
					)
242
					.add(LootItem.lootTableItem(Items.ECHO_SHARD).setWeight(4).apply(SetItemCountFunction.setCount(ContextIntProviders.between(1, 3))))
243
					.add(LootItem.lootTableItem(Items.DISC_FRAGMENT_5).setWeight(4).apply(SetItemCountFunction.setCount(ContextIntProviders.between(1, 3))))
244
					.add(
245
						LootItem.lootTableItem(Items.POTION)
246
							.setWeight(5)
247
							.apply(SetItemCountFunction.setCount(ContextIntProviders.between(1, 3)))
248
							.apply(SetPotionFunction.setPotion(Potions.STRONG_REGENERATION))
249
					)
250
					.add(LootItem.lootTableItem(Items.BOOK).setWeight(5).apply(EnchantRandomlyFunction.randomApplicableEnchantment(this.enchantments)))
251
					.add(LootItem.lootTableItem(Items.BOOK).setWeight(5).apply(SetItemCountFunction.setCount(ContextIntProviders.between(3, 10))))
252
					.add(LootItem.lootTableItem(Items.BONE).setWeight(5).apply(SetItemCountFunction.setCount(ContextIntProviders.between(1, 15))))
253
					.add(LootItem.lootTableItem(Items.SOUL_TORCH).setWeight(5).apply(SetItemCountFunction.setCount(ContextIntProviders.between(1, 15))))
254
					.add(LootItem.lootTableItem(Items.COAL).setWeight(7).apply(SetItemCountFunction.setCount(ContextIntProviders.between(6, 15))))
255
			)
256
			.withPool(
257
				LootPool.lootPool()
258
					.setRolls(ContextIntProviders.exactly(1))
259
					.add(EmptyLootItem.emptyItem().setWeight(71))
260
					.add(
261
						LootItem.lootTableItem(Items.BOOK)
262
							.setWeight(4)
263
							.apply(new EnchantRandomlyFunction.Builder().withEnchantment(this.enchantments.getOrThrow(Enchantments.MENDING)))
264
					)
265
					.add(LootItem.lootTableItem(Items.WARD_ARMOR_TRIM_SMITHING_TEMPLATE).setWeight(4))
266
					.add(LootItem.lootTableItem(Items.SILENCE_ARMOR_TRIM_SMITHING_TEMPLATE).setWeight(1))
267
			);
268
	}
269
270
	public LootTable.Builder jungleTempleLootTable() {
271
		return LootTable.lootTable()
272
			.withPool(
273
				LootPool.lootPool()
274
					.setRolls(ContextIntProviders.between(2, 6))
275
					.add(LootItem.lootTableItem(Items.DIAMOND).setWeight(3).apply(SetItemCountFunction.setCount(ContextIntProviders.between(1, 3))))
276
					.add(LootItem.lootTableItem(Items.IRON_INGOT).setWeight(10).apply(SetItemCountFunction.setCount(ContextIntProviders.between(1, 5))))
277
					.add(LootItem.lootTableItem(Items.GOLD_INGOT).setWeight(15).apply(SetItemCountFunction.setCount(ContextIntProviders.between(2, 7))))
278
					.add(LootItem.lootTableItem(Blocks.BAMBOO).setWeight(15).apply(SetItemCountFunction.setCount(ContextIntProviders.between(1, 3))))
279
					.add(LootItem.lootTableItem(Items.EMERALD).setWeight(2).apply(SetItemCountFunction.setCount(ContextIntProviders.between(1, 3))))
280
					.add(LootItem.lootTableItem(Items.BONE).setWeight(20).apply(SetItemCountFunction.setCount(ContextIntProviders.between(4, 6))))
281
					.add(LootItem.lootTableItem(Items.ROTTEN_FLESH).setWeight(16).apply(SetItemCountFunction.setCount(ContextIntProviders.between(3, 7))))
282
					.add(LootItem.lootTableItem(Items.SADDLE).setWeight(3))
283
					.add(LootItem.lootTableItem(Items.COPPER_HORSE_ARMOR))
284
					.add(LootItem.lootTableItem(Items.IRON_HORSE_ARMOR))
285
					.add(LootItem.lootTableItem(Items.GOLDEN_HORSE_ARMOR))
286
					.add(LootItem.lootTableItem(Items.DIAMOND_HORSE_ARMOR))
287
					.add(LootItem.lootTableItem(Items.BOOK).apply(EnchantWithLevelsFunction.enchantWithLevels(this.enchantments, ContextIntProviders.exactly(30))))
288
			)
289
			.withPool(
290
				LootPool.lootPool()
291
					.setRolls(ContextIntProviders.exactly(1))
292
					.add(EmptyLootItem.emptyItem().setWeight(2))
293
					.add(LootItem.lootTableItem(Items.WILD_ARMOR_TRIM_SMITHING_TEMPLATE).setWeight(1).apply(SetItemCountFunction.setCount(ContextIntProviders.exactly(2))))
294
			)
295
			.withPool(
296
				LootPool.lootPool()
297
					.setRolls(ContextIntProviders.exactly(1))
298
					.add(EmptyLootItem.emptyItem().setWeight(1))
299
					.add(
300
						LootItem.lootTableItem(Items.BOOK).apply(new EnchantRandomlyFunction.Builder().withEnchantment(this.enchantments.getOrThrow(Enchantments.UNBREAKING)))
301
					)
302
			);
303
	}
304
}
305

Decompiled Minecraft 26.3 source of TradeRebalanceChestLoot (net/minecraft/data/loot/packs/TradeRebalanceChestLoot.java) with Mojang official mappings, stored verbatim on the site.