本文整理匯總了Java中net.minecraft.util.WeightedRandom.getItem方法的典型用法代碼示例。如果您正苦於以下問題:Java WeightedRandom.getItem方法的具體用法?Java WeightedRandom.getItem怎麽用?Java WeightedRandom.getItem使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.util.WeightedRandom
的用法示例。
在下文中一共展示了WeightedRandom.getItem方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getWeightedBiomeEntry
import net.minecraft.util.WeightedRandom; //導入方法依賴的package包/類
protected BiomeEntry getWeightedBiomeEntry()
{
if(biomeEntries == null || biomeEntries.isEmpty())
return new BiomeEntry(BiomeGenBase.ocean, 100);
List<BiomeEntry> biomeList = biomeEntries;
int totalWeight = WeightedRandom.getTotalWeight(biomeList);
int weight = nextInt(Math.max(totalWeight / 10,1)) * 10;
return (BiomeEntry)WeightedRandom.getItem(biomeList, weight);
}
示例2: getWeightedBiomeEntry
import net.minecraft.util.WeightedRandom; //導入方法依賴的package包/類
protected BiomeManager.BiomeEntry getWeightedBiomeEntry(BiomeManager.BiomeType type)
{
List<BiomeManager.BiomeEntry> biomeList = biomes[type.ordinal()];
int totalWeight = WeightedRandom.getTotalWeight(biomeList);
int weight = BiomeManager.isTypeListModded(type)?nextInt(totalWeight):nextInt(totalWeight / 10) * 10;
return (BiomeManager.BiomeEntry)WeightedRandom.getItem(biomeList, weight);
}
示例3: getWeightedBiomeFromList
import net.minecraft.util.WeightedRandom; //導入方法依賴的package包/類
private int getWeightedBiomeFromList(List<BiomeEntry> biomeList){
int totalWeight = WeightedRandom.getTotalWeight(biomeList);
long randomLong = this.nextLong(totalWeight / 10);
int randomNr = (int)randomLong * 10;
BiomeEntry entry = (BiomeEntry)WeightedRandom.getItem(biomeList, randomNr);
int biomeID = entry.biome.biomeID;
return ((BiomeEntry)WeightedRandom.getItem(biomeList, (int)this.nextLong(WeightedRandom.getTotalWeight(biomeList) / 10) * 10)).biome.biomeID;
}
示例4: getInts
import net.minecraft.util.WeightedRandom; //導入方法依賴的package包/類
/**
* Returns a list of integer values generated by this layer. These may be interpreted as temperatures, rainfall
* amounts, or biomeList[] indices based on the particular GenLayer subclass.
*/
public int[] getInts(int p_75904_1_, int p_75904_2_, int p_75904_3_, int p_75904_4_)
{
int[] aint = this.parent.getInts(p_75904_1_, p_75904_2_, p_75904_3_, p_75904_4_);
int[] aint1 = IntCache.getIntCache(p_75904_3_ * p_75904_4_);
for (int i1 = 0; i1 < p_75904_4_; ++i1)
{
for (int j1 = 0; j1 < p_75904_3_; ++j1)
{
this.initChunkSeed((long)(j1 + p_75904_1_), (long)(i1 + p_75904_2_));
int k1 = aint[j1 + i1 * p_75904_3_];
int l1 = (k1 & 3840) >> 8;
k1 &= -3841;
if (isBiomeOceanic(k1))
{
aint1[j1 + i1 * p_75904_3_] = k1;
}
else if (k1 == BiomeGenBase.mushroomIsland.biomeID)
{
aint1[j1 + i1 * p_75904_3_] = k1;
}
else if (k1 == 1)
{
if (l1 > 0)
{
if (this.nextInt(3) == 0)
{
aint1[j1 + i1 * p_75904_3_] = BiomeGenBase.mesaPlateau.biomeID;
}
else
{
aint1[j1 + i1 * p_75904_3_] = BiomeGenBase.mesaPlateau_F.biomeID;
}
}
else
{
aint1[j1 + i1 * p_75904_3_] = ((BiomeEntry)WeightedRandom.getItem(this.desertBiomes, (int)(this.nextLong(WeightedRandom.getTotalWeight(this.desertBiomes) / 10) * 10))).biome.biomeID;
}
}
else if (k1 == 2)
{
if (l1 > 0)
{
aint1[j1 + i1 * p_75904_3_] = BiomeGenBase.jungle.biomeID;
}
else
{
aint1[j1 + i1 * p_75904_3_] = ((BiomeEntry)WeightedRandom.getItem(this.warmBiomes, (int)(this.nextLong(WeightedRandom.getTotalWeight(this.warmBiomes) / 10) * 10))).biome.biomeID;
}
}
else if (k1 == 3)
{
if (l1 > 0)
{
aint1[j1 + i1 * p_75904_3_] = BiomeGenBase.megaTaiga.biomeID;
}
else
{
aint1[j1 + i1 * p_75904_3_] = ((BiomeEntry)WeightedRandom.getItem(this.coolBiomes, (int)(this.nextLong(WeightedRandom.getTotalWeight(this.coolBiomes) / 10) * 10))).biome.biomeID;
}
}
else if (k1 == 4)
{
aint1[j1 + i1 * p_75904_3_] = ((BiomeEntry)WeightedRandom.getItem(this.icyBiomes, (int)(this.nextLong(WeightedRandom.getTotalWeight(this.icyBiomes) / 10) * 10))).biome.biomeID;
}
else
{
aint1[j1 + i1 * p_75904_3_] = BiomeGenBase.mushroomIsland.biomeID;
}
}
}
return aint1;
}
示例5: getInts
import net.minecraft.util.WeightedRandom; //導入方法依賴的package包/類
public int[] getInts(int p_75904_1_, int p_75904_2_, int p_75904_3_, int p_75904_4_)
{
int[] aint = this.parent.getInts(p_75904_1_, p_75904_2_, p_75904_3_, p_75904_4_);
int[] aint1 = IntCache.getIntCache(p_75904_3_ * p_75904_4_);
for (int i1 = 0; i1 < p_75904_4_; ++i1)
{
for (int j1 = 0; j1 < p_75904_3_; ++j1)
{
this.initChunkSeed((long)(j1 + p_75904_1_), (long)(i1 + p_75904_2_));
int k1 = aint[j1 + i1 * p_75904_3_];
int l1 = (k1 & 3840) >> 8;
k1 &= -3841;
if (isBiomeOceanic(k1))
{
aint1[j1 + i1 * p_75904_3_] = k1;
}
else if (k1 == BiomeGenBase.mushroomIsland.biomeID)
{
aint1[j1 + i1 * p_75904_3_] = k1;
}
else if (k1 == 1)
{
if (l1 > 0)
{
if (this.nextInt(3) == 0)
{
aint1[j1 + i1 * p_75904_3_] = BiomeGenBase.mesaPlateau.biomeID;
}
else
{
aint1[j1 + i1 * p_75904_3_] = BiomeGenBase.mesaPlateau_F.biomeID;
}
}
else
{
aint1[j1 + i1 * p_75904_3_] = ((BiomeEntry)WeightedRandom.getItem(this.desertBiomes, (int)(this.nextLong(WeightedRandom.getTotalWeight(this.desertBiomes) / 10) * 10))).biome.biomeID;
}
}
else if (k1 == 2)
{
if (l1 > 0)
{
aint1[j1 + i1 * p_75904_3_] = BiomeGenBase.jungle.biomeID;
}
else
{
aint1[j1 + i1 * p_75904_3_] = ((BiomeEntry)WeightedRandom.getItem(this.warmBiomes, (int)(this.nextLong(WeightedRandom.getTotalWeight(this.warmBiomes) / 10) * 10))).biome.biomeID;
}
}
else if (k1 == 3)
{
if (l1 > 0)
{
aint1[j1 + i1 * p_75904_3_] = BiomeGenBase.megaTaiga.biomeID;
}
else
{
aint1[j1 + i1 * p_75904_3_] = ((BiomeEntry)WeightedRandom.getItem(this.coolBiomes, (int)(this.nextLong(WeightedRandom.getTotalWeight(this.coolBiomes) / 10) * 10))).biome.biomeID;
}
}
else if (k1 == 4)
{
aint1[j1 + i1 * p_75904_3_] = ((BiomeEntry)WeightedRandom.getItem(this.icyBiomes, (int)(this.nextLong(WeightedRandom.getTotalWeight(this.icyBiomes) / 10) * 10))).biome.biomeID;
}
else
{
aint1[j1 + i1 * p_75904_3_] = BiomeGenBase.mushroomIsland.biomeID;
}
}
}
return aint1;
}