Skip to content

Commit 33843e1

Browse files
committed
Expose WeightedRandomList total weight and entries.
1 parent a547115 commit 33843e1

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package net.darkhax.bookshelf.mixin.util.random;
2+
3+
import com.google.common.collect.ImmutableList;
4+
import net.minecraft.util.random.WeightedRandomList;
5+
import org.spongepowered.asm.mixin.Mixin;
6+
import org.spongepowered.asm.mixin.gen.Accessor;
7+
8+
@Mixin(WeightedRandomList.class)
9+
public interface AccessorWeightedRandomList<E> {
10+
11+
@Accessor("totalWeight")
12+
int bookshelf$getTotalWeight();
13+
14+
@Accessor("items")
15+
ImmutableList<E> bookshelf$getEntries();
16+
}

Common/src/main/resources/bookshelf.common.mixins.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
"item.AccessorItem",
1818
"item.AccessorItemCooldowns",
1919
"item.crafting.AccessorShapedRecipe",
20-
"loot.MixinLootItemKilledByPlayerCondition"
20+
"loot.MixinLootItemKilledByPlayerCondition",
21+
"util.random.AccessorWeightedRandomList"
2122
],
2223
"client": [
2324
"client.AccessorFontManager",

0 commit comments

Comments
 (0)