aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/WeighedRandom.h
blob: 71066c22c14d7ac5d61e2c8e74b909a5768a83d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#pragma once
// 4J - this WeighedRandomItem class was a nested static class within WeighedRandom, but we need to be able to refer to it externally

class WeighedRandomItem
{
	friend class WeighedRandom;
protected:
	int randomWeight;

public:
	WeighedRandomItem(int randomWeight)
	{
        this->randomWeight = randomWeight;
    }
};

class WeighedRandom
{
public:
	// 4J - vectors here were Collection<? extends WeighedRandomItem>
	static int getTotalWeight(vector<WeighedRandomItem *> *items);	
	static WeighedRandomItem *getRandomItem(Random *random, vector<WeighedRandomItem *> *items, int totalWeight);
	static WeighedRandomItem *getRandomItem(Random *random, vector<WeighedRandomItem *> *items);
	static int getTotalWeight(WeighedRandomItemArray items);
	static WeighedRandomItem *getRandomItem(Random *random, WeighedRandomItemArray items, int totalWeight);
	static WeighedRandomItem *getRandomItem(Random *random, WeighedRandomItemArray items);

};