@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 ); }
@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); }
@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); }
@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); }
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); } } }
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); } } }
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; }
/** * @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)); } }
@Override public StructureVillagePieces.PieceWeight getVillagePieceWeight(Random random, int size) { return new StructureVillagePieces.PieceWeight(FossilDigsite.class, 1, MathHelper.getInt(random, 0, 1)); }
@Override public StructureVillagePieces.PieceWeight getVillagePieceWeight(Random random, int size) { return new StructureVillagePieces.PieceWeight(VillageApiaristHouse.class, 15, MathHelper.getInt(random, size, 1 + size)); }
@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); }
@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; }
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); }
/** * 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]; }
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; }
@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; }
@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); } } }
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; }
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); }
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); }