本文整理了Java中net.minecraft.util.math.MathHelper.getInt()
方法的一些代码示例,展示了MathHelper.getInt()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MathHelper.getInt()
方法的具体详情如下:
包路径:net.minecraft.util.math.MathHelper
类名称:MathHelper
方法名:getInt
暂无
代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2
@Override
public int getExpDrop( IBlockState state, IBlockAccess world, BlockPos pos, int fortune )
{
Random rand = world instanceof World ? ( (World) world ).rand : new Random();
if( this.getItemDropped( state, rand, fortune ) != Item.getItemFromBlock( this ) )
{
return MathHelper.getInt( rand, 2, 5 );
}
return super.getExpDrop( state, world, pos, fortune );
}
代码示例来源:origin: Vazkii/Quark
@Override
public int getExpDrop(IBlockState state, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) {
Random rand = world instanceof World ? ((World)world).rand : new Random();
return MathHelper.getInt(rand, 2, 5);
}
代码示例来源:origin: PrinceOfAmber/Cyclic
@Override
public int getExpDrop(IBlockState state, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) {
Random rand = world instanceof World ? ((World) world).rand : new Random();
return MathHelper.getInt(rand, 2, 5);
}
代码示例来源:origin: vadis365/TheErebus
@Override
public int getExpDrop(IBlockState state, IBlockAccess world, BlockPos pos, int fortune) {
Random rand = world instanceof World ? ((World) world).rand : new Random();
return MathHelper.getInt(rand, minXP, maxXP);
}
代码示例来源:origin: Alex-the-666/Ice_and_Fire
public MapGenPixieVillage(Map<String, String> map) {
this();
for (Entry<String, String> entry : map.entrySet()) {
if (((String) entry.getKey()).equals("size")) {
this.size = MathHelper.getInt((String) entry.getValue(), this.size, 0);
} else if (((String) entry.getKey()).equals("distance")) {
this.distance = MathHelper.getInt((String) entry.getValue(), this.distance, 9);
}
}
}
代码示例来源:origin: Alex-the-666/Ice_and_Fire
public MapGenSnowVillage(Map<String, String> map) {
this();
for (Entry<String, String> entry : map.entrySet()) {
if (((String) entry.getKey()).equals("size")) {
this.size = MathHelper.getInt((String) entry.getValue(), this.size, 0);
} else if (((String) entry.getKey()).equals("distance")) {
this.distance = MathHelper.getInt((String) entry.getValue(), this.distance, 9);
}
}
}
代码示例来源:origin: Alex-the-666/Ice_and_Fire
public static List<SnowVillagePieces.PieceWeight> getStructureVillageWeightedPieceList(Random random, int size) {
List<SnowVillagePieces.PieceWeight> list = Lists.<PieceWeight>newArrayList();
list.add(new PieceWeight(TorchNew.class, 75, MathHelper.getInt(random, 5 + size, 6 + size)));
list.add(new PieceWeight(WoodHut.class, 65, MathHelper.getInt(random, 3 + size, 5 + size)));
Iterator<SnowVillagePieces.PieceWeight> iterator = list.iterator();
while (iterator.hasNext()) {
if (((PieceWeight) iterator.next()).villagePiecesLimit == 0) {
iterator.remove();
}
}
return list;
}
代码示例来源:origin: TeamLapen/Vampirism
/**
* @param random
* @param terrainType Apparently rather the village size, than the terrain type
* @return
*/
@Override
public StructureVillagePieces.PieceWeight getVillagePieceWeight(Random random, int terrainType) {
return new StructureVillagePieces.PieceWeight(VillagePieceModChurch.class, 20, MathHelper.getInt(random, 0, 1 + terrainType));
}
}
代码示例来源:origin: JurassiCraftTeam/JurassiCraft2
@Override
public StructureVillagePieces.PieceWeight getVillagePieceWeight(Random random, int size) {
return new StructureVillagePieces.PieceWeight(FossilDigsite.class, 1, MathHelper.getInt(random, 0, 1));
}
代码示例来源:origin: ForestryMC/ForestryMC
@Override
public StructureVillagePieces.PieceWeight getVillagePieceWeight(Random random, int size) {
return new StructureVillagePieces.PieceWeight(VillageApiaristHouse.class, 15, MathHelper.getInt(random, size, 1 + size));
}
代码示例来源:origin: ForestryMC/ForestryMC
@Override
public int getExpDrop(IBlockState state, IBlockAccess world, BlockPos pos, int fortune) {
Random rand = world instanceof World ? ((World) world).rand : new Random();
if (state.getValue(ORE_RESOURCES) == EnumResourceType.APATITE) {
return MathHelper.getInt(rand, 1, 4);
}
return super.getExpDrop(state, world, pos, fortune);
}
代码示例来源:origin: Alex-the-666/Ice_and_Fire
@Override
public int getExpDrop(IBlockState state, net.minecraft.world.IBlockAccess world, BlockPos pos, int fortune) {
Random rand = world instanceof World ? ((World) world).rand : new Random();
if (this.getItemDropped(state, rand, fortune) != Item.getItemFromBlock(this)) {
if (this == ModBlocks.sapphireOre) {
return MathHelper.getInt(rand, 3, 7);
}
}
return 0;
}
代码示例来源:origin: PrinceOfAmber/Cyclic
public static BlockPos getRandomPos(Random rand, BlockPos here, int hRadius) {
int x = here.getX();
int z = here.getZ();
// search in a square
int xMin = x - hRadius;
int xMax = x + hRadius;
int zMin = z - hRadius;
int zMax = z + hRadius;
int posX = MathHelper.getInt(rand, xMin, xMax);
int posZ = MathHelper.getInt(rand, zMin, zMax);
return new BlockPos(posX, here.getY(), posZ);
}
代码示例来源:origin: PrinceOfAmber/Cyclic
/**
* TODO: util
*
* @param rand
* @return
*/
public static EnumFacing getRandom(Random rand) {
int index = MathHelper.getInt(rand, 0, EnumFacing.values().length - 1);
return EnumFacing.values()[index];
}
代码示例来源:origin: Alex-the-666/Ice_and_Fire
public static StructureBoundingBox findPieceBox(Start start, List<StructureComponent> p_175848_1_, Random rand, int p_175848_3_, int p_175848_4_, int p_175848_5_, EnumFacing facing) {
for (int i = 3 * MathHelper.getInt(rand, 3, 5); i >= 3; i -= 3) {
StructureBoundingBox structureboundingbox = StructureBoundingBox.getComponentToAddBoundingBox(p_175848_3_, p_175848_4_, p_175848_5_, 0, 0, 0, 1, 1, i, facing);
if (StructureComponent.findIntersecting(p_175848_1_, structureboundingbox) == null) {
return structureboundingbox;
}
}
return null;
}
代码示例来源:origin: MatterOverdrive/MatterOverdrive-Legacy-Edition
@Override
public int getExpDrop(IBlockState state, IBlockAccess world, BlockPos pos, int fortune) {
if (this.getItemDropped(world.getBlockState(pos), rand, fortune) != Item.getItemFromBlock(this)) {
return MathHelper.getInt(rand, 2, 5);
}
return 0;
}
代码示例来源:origin: NanamiArihara/FoodCraft-Reloaded
@SubscribeEvent
public void generateFruitTree(DecorateBiomeEvent.Decorate event) {
if (event.getType() == DecorateBiomeEvent.Decorate.EventType.TREE && event.getRand().nextFloat() <= GENERATE_PERCENTAGE) {
BaseTreeGenerator[] generatorBasicTrees = generatorTreeMap.values().toArray(new BaseTreeGenerator[0]);
BaseTreeGenerator generator = generatorBasicTrees[MathHelper.getInt(event.getRand(),0, generatorBasicTrees.length - 1)];
if (generator.generate(event.getWorld(), event.getRand(), event.getPos())) {
FoodCraftReloaded.getLogger().debug("Generated fruit tree at " + event.getPos());
event.setResult(Event.Result.DENY);
}
}
}
代码示例来源:origin: CyclopsMC/EvilCraft
private VengeanceSpirit createNewVengeanceSpirit() {
Random rand = world.rand;
VengeanceSpirit spirit = VengeanceSpirit.fromNBT(getWorld(), getSpiritTag());
spirit.setPosition(getPos().getX() + rand.nextDouble(), getPos().getY() + rand.nextDouble(),
getPos().getZ() + rand.nextDouble());
spirit.setFrozenDuration(0);
spirit.setGlobalVengeance(true);
spirit.setRemainingLife(MathHelper.getInt(world.rand,
VengeanceSpirit.REMAININGLIFE_MIN, VengeanceSpirit.REMAININGLIFE_MAX));
return spirit;
}
代码示例来源:origin: JurassiCraftTeam/JurassiCraft2
public void grow(World world, BlockPos pos, IBlockState state) {
// TODO: Pull out these two numbers.
int i = state.getValue(this.getAgeProperty()) + MathHelper.getInt(world.rand, 2, 5);
if (i > this.getMaxAge()) {
i = this.getMaxAge();
}
world.setBlockState(pos, state.withProperty(this.getAgeProperty(), i), 2);
}
代码示例来源:origin: PrinceOfAmber/Cyclic
public void createBullet(World world, EntityPlayer player) {
EntityGolemLaser bullet = new EntityGolemLaser(world);
int colorIndex = MathHelper.getInt(world.rand, 0, VariantColors.values().length - 1);
bullet.getDataManager().set(EntityGolemLaser.variant, colorIndex);
float speed = 4.0F;
bullet.initCustom(player.posX, player.posY + 1.52, player.posZ,
player.getLookVec().x * 0.5, player.getLookVec().y * 0.5, player.getLookVec().z * 0.5,
speed, player.getUniqueID());
// if (world.isRemote == false)
world.spawnEntity(bullet);
}
内容来源于网络,如有侵权,请联系作者删除!