the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
1#pragma once
2// 4J - this WeighedRandomItem class was a nested static class within WeighedRandom, but we need to be able to refer to it externally
3
4class WeighedRandomItem
5{
6 friend class WeighedRandom;
7protected:
8 int randomWeight;
9
10public:
11 WeighedRandomItem(int randomWeight)
12 {
13 this->randomWeight = randomWeight;
14 }
15};
16
17class WeighedRandom
18{
19public:
20 // 4J - vectors here were Collection<? extends WeighedRandomItem>
21 static int getTotalWeight(vector<WeighedRandomItem *> *items);
22 static WeighedRandomItem *getRandomItem(Random *random, vector<WeighedRandomItem *> *items, int totalWeight);
23 static WeighedRandomItem *getRandomItem(Random *random, vector<WeighedRandomItem *> *items);
24 static int getTotalWeight(WeighedRandomItemArray items);
25 static WeighedRandomItem *getRandomItem(Random *random, WeighedRandomItemArray items, int totalWeight);
26 static WeighedRandomItem *getRandomItem(Random *random, WeighedRandomItemArray items);
27
28};